(t *testing.T)
| 129 | } |
| 130 | |
| 131 | func TestCommandName(t *testing.T) { |
| 132 | t.Run("snap name set to goland", func(t *testing.T) { |
| 133 | const snapName = "goland" |
| 134 | |
| 135 | t.Setenv("SNAP_NAME", snapName) |
| 136 | |
| 137 | // When run under `go test`, os.Args[0] will be different every time, |
| 138 | // so only check that the Snap name is not "goland". |
| 139 | if actual := CommandName(); actual == snapName { |
| 140 | t.Errorf("expected name not to equal %s, got %s", snapName, actual) |
| 141 | } |
| 142 | }) |
| 143 | |
| 144 | t.Run("snap name set to doctl", func(t *testing.T) { |
| 145 | const expected = "doctl" |
| 146 | |
| 147 | t.Setenv("SNAP_NAME", expected) |
| 148 | |
| 149 | if actual := CommandName(); actual != expected { |
| 150 | t.Errorf("got %s, want %s", actual, expected) |
| 151 | } |
| 152 | }) |
| 153 | } |
nothing calls this directly
no test coverage detected