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

Method test_comment

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

Source from the content-addressed store, hash-verified

878 self.assertEqual(m.functions, {"a"})
879
880 def test_comment(self):
881 cmd = "bar # a comment"
882
883 shellresults = [MR(4, 15, help_constants.COMMENT, "# a comment")]
884 matchresults = [MR(0, 3, "bar synopsis", "bar")]
885
886 m = matcher.Matcher(cmd, s)
887 groups = m.match()
888 self.assertEqual(len(groups), 2)
889 self.assertEqual(groups[0].results, shellresults)
890 self.assertEqual(groups[1].results, matchresults)
891
892 cmd = "# just a comment"
893
894 shellresults = [MR(0, 16, help_constants.COMMENT, "# just a comment")]
895
896 m = matcher.Matcher(cmd, s)
897 groups = m.match()
898 self.assertEqual(len(groups), 1)
899 self.assertEqual(groups[0].results, shellresults)
900
901 def test_heredoc_at_eof(self):
902 cmd = "bar <<EOF"

Callers

nothing calls this directly

Calls 1

matchMethod · 0.95

Tested by

no test coverage detected