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

Method test_known_and_unknown_program

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

Source from the content-addressed store, hash-verified

542 self.assertRaises(bashlex.errors.ParsingError, matcher.Matcher(cmd, s).match)
543
544 def test_known_and_unknown_program(self):
545 cmd = "bar; foo arg >f; baz"
546 matchedresult = [
547 [
548 MR(3, 4, help_constants.OPERATORS[";"], ";"),
549 MR(
550 13,
551 15,
552 help_constants.REDIRECTION
553 + "\n\n"
554 + help_constants.REDIRECTION_KIND[">"],
555 ">f",
556 ),
557 MR(15, 16, help_constants.OPERATORS[";"], ";"),
558 ],
559 [MR(0, 3, "bar synopsis", "bar")],
560 [MR(5, 12, None, "foo arg")],
561 [MR(17, 20, "baz synopsis", "baz")],
562 ]
563
564 groups = matcher.Matcher(cmd, s).match()
565 self.assertEqual(groups[0].results, matchedresult[0])
566 self.assertEqual(groups[1].results, matchedresult[1])
567 self.assertEqual(groups[2].results, matchedresult[2])
568
569 def test_pipe(self):
570 cmd = "bar | baz"

Callers

nothing calls this directly

Calls 1

matchMethod · 0.80

Tested by

no test coverage detected