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

Method test_for_expansion

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

Source from the content-addressed store, hash-verified

761 self.assertEqual(groups[2].results, matchresults[1])
762
763 def test_for_expansion(self):
764 cmd = "for a in $(bar); do baz; done"
765 shellresults = [
766 MR(0, 19, help_constants._for, "for a in $(bar); do"),
767 MR(23, 29, help_constants._for, "; done"),
768 ]
769
770 matchresults = [MR(20, 23, "baz synopsis", "baz")]
771
772 m = matcher.Matcher(cmd, s)
773 groups = m.match()
774 self.assertEqual(len(groups), 2)
775 self.assertEqual(groups[0].results, shellresults)
776 self.assertEqual(groups[1].results, matchresults)
777
778 self.assertEqual(m.expansions, [(11, 14, "substitution")])
779
780 def test_assignment_with_expansion(self):
781 cmd = 'a="$1" bar'

Callers

nothing calls this directly

Calls 1

matchMethod · 0.95

Tested by

no test coverage detected