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

Method test_multiple_nests

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

Source from the content-addressed store, hash-verified

505 self.assertEqual(groups[2].results, matchedresult[1])
506
507 def test_multiple_nests(self):
508 cmd = "withargs withargs -b arg bar"
509
510 matchedresult = [
511 [MR(0, 8, "withargs synopsis", "withargs")],
512 [
513 MR(9, 17, "withargs synopsis", "withargs"),
514 MR(18, 24, "-b <arg> desc", "-b arg"),
515 ],
516 [MR(25, 28, "bar synopsis", "bar")],
517 ]
518
519 groups = matcher.Matcher(cmd, s).match()
520 self.assertEqual(len(groups), 4)
521 self.assertEqual(groups[0].results, [])
522 self.assertEqual(groups[1].results, matchedresult[0])
523 self.assertEqual(groups[2].results, matchedresult[1])
524 self.assertEqual(groups[3].results, matchedresult[2])
525
526 def test_nested_command_is_unknown(self):
527 cmd = "withargs -b arg unknown"

Callers

nothing calls this directly

Calls 1

matchMethod · 0.80

Tested by

no test coverage detected