(t *testing.T)
| 1309 | } |
| 1310 | |
| 1311 | func TestJSONOperationOutputContractShape(t *testing.T) { |
| 1312 | encoded, err := json.Marshal(newJSONOperationOutput(nil, nil, nil)) |
| 1313 | if err != nil { |
| 1314 | t.Fatalf("marshal operation output: %v", err) |
| 1315 | } |
| 1316 | |
| 1317 | var raw map[string]json.RawMessage |
| 1318 | if err := json.Unmarshal(encoded, &raw); err != nil { |
| 1319 | t.Fatalf("decode operation output: %v", err) |
| 1320 | } |
| 1321 | for _, key := range []string{"ok", "schema_version", "command", "input", "results", "warnings"} { |
| 1322 | if _, ok := raw[key]; !ok { |
| 1323 | t.Fatalf("operation output = %s, missing %q", encoded, key) |
| 1324 | } |
| 1325 | } |
| 1326 | if len(raw) != 6 { |
| 1327 | t.Fatalf("operation output = %s, want only ok/schema_version/command/input/results/warnings", encoded) |
| 1328 | } |
| 1329 | } |
| 1330 | |
| 1331 | func TestUnsupportedCommandsReturnJSONErrorEnvelope(t *testing.T) { |
| 1332 | for _, name := range []string{"login", "completion"} { |
nothing calls this directly
no test coverage detected