diff tests/test_algpseudo.py @ 75:711f8d19e27a

New implementation of "STATEMENT" (also aliased to "STATE" and "BLOCK"). Now this needs curly braces.
author Franz Glasner <fzglas.hg@dom66.de>
date Wed, 29 Apr 2026 12:43:28 +0200
parents c1357674622d
children 27e12387154d
line wrap: on
line diff
--- a/tests/test_algpseudo.py	Tue Apr 28 20:27:46 2026 +0200
+++ b/tests/test_algpseudo.py	Wed Apr 29 12:43:28 2026 +0200
@@ -330,6 +330,59 @@
                 r"  \text{mod} p""",
                 self.lexer))
 
+    def test_punctuation(self):
+        self.assertTokenStreamEqualComplete(
+            [("Punctuation", "{"),
+             ("Punctuation", "}"),
+             ("Punctuation", ":"),
+             ("Punctuation", "("),
+             ("Punctuation", ")"),
+             ("Punctuation", ","),
+             ("Punctuation", ";"),
+             ("Punctuation", "["),
+             ("Punctuation", "]"),
+             ("Text.Whitespace", "\n"),
+             ],
+            pygments.lex(r"{}:(),;[]", self.lexer))
+
+    def test_block_empty(self):
+        self.assertTokenStreamEqualComplete(
+            [("Text", "◆"),
+             ("Text.Whitespace", " "),
+             ("Text.Whitespace", "\n"),
+             ],
+            pygments.lex(r"\block{}", self.lexer))
+
+    def test_block_with_text(self):
+        self.assertTokenStreamEqualComplete(
+            [("Text", "◆"),
+             ("Text.Whitespace", " "),
+             ("Text", "a b c"),
+             ("Text.Whitespace", "\n"),
+             ],
+            pygments.lex(r"\block{\text{a b c}}", self.lexer))
+
+    def test_block(self):
+        self.assertTokenStreamEqualComplete(
+            [("Text", "◆"),
+             ("Text.Whitespace", " "),
+             ("Name.Entity", "a"),
+             ("Text", " "),
+             ("Number.Float", "1.2"),
+             ("Text", " "),
+             ("Punctuation", "{"),
+             ("Name.Entity", "x"),
+             ("Text", " "),
+             ("Operator.Word", "in"),
+             ("Text", " "),
+             ("Name.Entity", "X"),
+             ("Punctuation", "}"),
+             ("Text", " "),
+             ("Name.Entity", "c"),
+             ("Text.Whitespace", "\n"),
+             ],
+            pygments.lex(r"\state{a 1.2 {x in X\} c}", self.lexer))
+
 
 class PygmentizeCompletely(unittest.TestCase):