Skip to content

High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.

test: pin which save commands declare --json, so criterion six's unreachability premise reds if one gains the flag (PIN-048)

Luigi Agostibbd460b9e3eb
diff --git a/cmd/pinchtab/save_command_json_flag_test.go b/cmd/pinchtab/save_command_json_flag_test.go
new file mode 100644
index 00000000..e6d31fdc
--- /dev/null
+++ b/cmd/pinchtab/save_command_json_flag_test.go
@@ -0,0 +1,27 @@
+package main
+
+import "testing"
+
+func TestSaveCommandsDeclareJSONOnlyWhereTheOutputShapeNeedsIt(t *testing.T) {
+ want := map[string]bool{
+ "capture": true,
+ "download": false,
+ "screenshot": false,
+ "pdf": false,
+ }
+
+ for name, wantJSON := range want {
+ cmd, _, err := rootCmd.Find([]string{name})
+ if err != nil || cmd == nil || cmd.Name() != name {
+ t.Fatalf("%q is not a command on this CLI, so this guard would pass over nothing", name)
+ }
+ if cmd.Flags().Lookup("output") == nil && cmd.Flags().ShorthandLookup("o") == nil {
+ t.Fatalf("%q declares no -o flag, so it is no longer one of the save commands this guard covers", name)
+ }
+
+ gotJSON := cmd.Flags().Lookup("json") != nil
+ if gotJSON != wantJSON {
+ t.Errorf("%q declares --json=%v, want %v; if that is intended, decide and pin what --json does when combined with -o", name, gotJSON, wantJSON)
+ }
+ }
+}