comparison tests/test_algpseudo.py @ 114:be50fe0687d6

The \CALL command
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 06 May 2026 01:10:11 +0200
parents 9aea2fd5f037
children e1663ac707b0
comparison
equal deleted inserted replaced
113:9aea2fd5f037 114:be50fe0687d6
897 ("Number.Float", "2.7"), 897 ("Number.Float", "2.7"),
898 ("Text.Whitespace", "\n"), 898 ("Text.Whitespace", "\n"),
899 ], 899 ],
900 pygments.lex(r"a \gets 2.7", lexer)) 900 pygments.lex(r"a \gets 2.7", lexer))
901 901
902 def test_call(self):
903 self.assertTokenStreamEqualComplete(
904 [("Name.Entity", "a function"),
905 ("Punctuation", "("),
906 ("Name.Entity", "p1"),
907 ("Punctuation", ","),
908 ("Text", " "),
909 ("Name.Entity", "p2"),
910 ("Punctuation", ")"),
911 ("Text.Whitespace", "\n"),
912 ],
913 pygments.lex(r"\CALL{a function}(p1, p2)", self.lexer))
914
915 def test_call_in_expr(self):
916 self.assertTokenStreamEqualComplete(
917 [("Name.Entity", "a procedure"),
918 ("Punctuation", "("),
919 ("Name.Entity", "arg1"),
920 ("Punctuation", ","),
921 ("Text", " "),
922 ("Name.Entity", "arg2"),
923 ("Punctuation", ","),
924 ("Text", " "),
925 ("Name.Entity", "arg3"),
926 ("Punctuation", ")"),
927 ("Text.Whitespace", "\n"),
928 ],
929 pygments.lex(r"\TEXT{\EXPR{\CALL{a procedure}(arg1, arg2, arg3)}}",
930 self.lexer))
931
902 932
903 class PygmentizeCompletely(unittest.TestCase): 933 class PygmentizeCompletely(unittest.TestCase):
904 934
905 def setUp(self): 935 def setUp(self):
906 self.lexer = pygments.lexers.load_lexer_from_file( 936 self.lexer = pygments.lexers.load_lexer_from_file(