TestCommandUsage tests that we output a command-specific usage message and return with a non-zero exit status.
(t *testing.T)
| 95 | // TestCommandUsage tests that we output a command-specific usage message and return |
| 96 | // with a non-zero exit status. |
| 97 | func TestCommandUsage(t *testing.T) { |
| 98 | var e env |
| 99 | out, err, code := e.Run("attr") |
| 100 | if code != 1 { |
| 101 | t.Errorf("exit code = %d; want 1", code) |
| 102 | } |
| 103 | if len(out) != 0 { |
| 104 | t.Errorf("wanted nothing on stdout; got:\n%s", out) |
| 105 | } |
| 106 | sub := "Attr takes 3 args: <permanode> <attr> <value>" |
| 107 | if !bytes.Contains(err, []byte(sub)) { |
| 108 | t.Errorf("stderr doesn't contain substring %q. Got:\n%s", sub, err) |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | func TestUploadingChangingDirectory(t *testing.T) { |
| 113 | // TODO(bradfitz): |