MCPcopy
hub / github.com/idank/explainshell / test_nested_command

Method test_nested_command

tests/test_matcher.py:408–427  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

406 self.assertMatchSingle(cmd, s.find_man_page("bar")[0], matchedresult)
407
408 def test_nested_command(self):
409 cmd = "withargs -b arg bar -a unknown"
410
411 matchedresult = [
412 [
413 MR(0, 8, "withargs synopsis", "withargs"),
414 MR(9, 15, "-b <arg> desc", "-b arg"),
415 ],
416 [
417 MR(16, 19, "bar synopsis", "bar"),
418 MR(20, 22, "-a desc", "-a"),
419 MR(23, 30, None, "unknown"),
420 ],
421 ]
422
423 groups = matcher.Matcher(cmd, s).match()
424 self.assertEqual(len(groups), 3)
425 self.assertEqual(groups[0].results, [])
426 self.assertEqual(groups[1].results, matchedresult[0])
427 self.assertEqual(groups[2].results, matchedresult[1])
428
429 def test_nested_option(self):
430 cmd = "withargs -b arg -exec bar -a EOF -b arg"

Callers

nothing calls this directly

Calls 1

matchMethod · 0.80

Tested by

no test coverage detected