MCPcopy Create free account
hub / github.com/idank/explainshell / test_positional_on_flagged_option

Method test_positional_on_flagged_option

tests/test_db_check.py:105–129  ·  view source on GitHub ↗

Options with short/long flags should not have positional set.

(self, store, db_path)

Source from the content-addressed store, hash-verified

103 assert any("shadowed duplicate" in msg for msg in errors_list)
104
105 def test_positional_on_flagged_option(self, store, db_path):
106 """Options with short/long flags should not have positional set."""
107 opts = json.dumps(
108 [
109 {
110 "text": "-D debugopts desc",
111 "short": ["-D"],
112 "long": [],
113 "has_argument": True,
114 "positional": "debugopts",
115 "nested_cmd": False,
116 }
117 ]
118 )
119 store._conn.execute("PRAGMA foreign_keys = OFF")
120 store._conn.execute(
121 "INSERT INTO parsed_manpages(source, name, options, aliases) "
122 "VALUES (?, ?, ?, '[]')",
123 ("ubuntu/26.04/1/find.1.gz", "find", opts),
124 )
125 store._conn.commit()
126 store._conn.execute("PRAGMA foreign_keys = ON")
127 issues = db_check(db_path)
128 warnings = [msg for sev, msg in issues if sev == "warning"]
129 assert any("positional on flagged option" in msg for msg in warnings)
130
131 def test_positional_on_positional_ok(self, store, db_path):
132 """Positional operands (no flags) with positional set should not warn."""

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected