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

Method test_function_reference

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

Source from the content-addressed store, hash-verified

855 self.assertEqual(m.expansions, [(22, 23, "substitution")])
856
857 def test_function_reference(self):
858 cmd = "function a() { bar; a b; }; a"
859 shellresults = [
860 MR(0, 14, help_constants._function, "function a() {"),
861 MR(18, 19, help_constants.OPSEMICOLON, ";"),
862 MR(20, 21, help_constants._function_call % "a", "a"),
863 MR(22, 23, help_constants._functionarg % "a", "b"),
864 MR(23, 24, help_constants.OPSEMICOLON, ";"),
865 MR(25, 26, help_constants._function, "}"),
866 MR(26, 27, help_constants.OPSEMICOLON, ";"),
867 MR(28, 29, help_constants._function_call % "a", "a"),
868 ]
869
870 matchresults = [MR(15, 18, "bar synopsis", "bar")]
871
872 m = matcher.Matcher(cmd, s)
873 groups = m.match()
874 self.assertEqual(len(groups), 2)
875 self.assertEqual(groups[0].results, shellresults)
876 self.assertEqual(groups[1].results, matchresults)
877
878 self.assertEqual(m.functions, {"a"})
879
880 def test_comment(self):
881 cmd = "bar # a comment"

Callers

nothing calls this directly

Calls 1

matchMethod · 0.95

Tested by

no test coverage detected