Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(19)

Side by Side Diff: cmd/juju/cmd_test.go

Issue 78660045: cmd: No longer panic if cwd is deleted (Closed)
Patch Set: Created 11 years ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2012, 2013 Canonical Ltd. 1 // Copyright 2012, 2013 Canonical Ltd.
2 // Licensed under the AGPLv3, see LICENCE file for details. 2 // Licensed under the AGPLv3, see LICENCE file for details.
3 3
4 package main 4 package main
5 5
6 import ( 6 import (
7 "io" 7 "io"
8 "io/ioutil" 8 "io/ioutil"
9 "os" 9 "os"
10 "reflect" 10 "reflect"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 assertConnName(c, com, "walthamstow") 116 assertConnName(c, com, "walthamstow")
117 117
118 com, args = cmdFunc() 118 com, args = cmdFunc()
119 if _, ok := com.(*StatusCommand); !ok { 119 if _, ok := com.(*StatusCommand); !ok {
120 testInit(c, com, append(args, "hotdog"), "unrecognized a rgs.*") 120 testInit(c, com, append(args, "hotdog"), "unrecognized a rgs.*")
121 } 121 }
122 } 122 }
123 } 123 }
124 124
125 func nullContext() *cmd.Context { 125 func nullContext() *cmd.Context {
126 » ctx := cmd.DefaultContext() 126 » ctx, _ := cmd.DefaultContext()
dimitern 2014/03/21 16:46:00 It's bad to ignore errors like this, how about: c
127 ctx.Stdin = io.LimitReader(nil, 0) 127 ctx.Stdin = io.LimitReader(nil, 0)
128 ctx.Stdout = ioutil.Discard 128 ctx.Stdout = ioutil.Discard
129 ctx.Stderr = ioutil.Discard 129 ctx.Stderr = ioutil.Discard
130 return ctx 130 return ctx
131 } 131 }
132 132
133 func runCommand(ctx *cmd.Context, com cmd.Command, args ...string) (opc chan dum my.Operation, errc chan error) { 133 func runCommand(ctx *cmd.Context, com cmd.Command, args ...string) (opc chan dum my.Operation, errc chan error) {
134 if ctx == nil { 134 if ctx == nil {
135 panic("ctx == nil") 135 panic("ctx == nil")
136 } 136 }
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after
369 } 369 }
370 370
371 func (*CmdSuite) TestDestroyUnitCommandInit(c *gc.C) { 371 func (*CmdSuite) TestDestroyUnitCommandInit(c *gc.C) {
372 // missing args 372 // missing args
373 _, err := initDestroyUnitCommand() 373 _, err := initDestroyUnitCommand()
374 c.Assert(err, gc.ErrorMatches, "no units specified") 374 c.Assert(err, gc.ErrorMatches, "no units specified")
375 // not a unit 375 // not a unit
376 _, err = initDestroyUnitCommand("seven/nine") 376 _, err = initDestroyUnitCommand("seven/nine")
377 c.Assert(err, gc.ErrorMatches, `invalid unit name "seven/nine"`) 377 c.Assert(err, gc.ErrorMatches, `invalid unit name "seven/nine"`)
378 } 378 }
OLDNEW

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b