diff options
| author | Colin Kennedy <colinvfx@gmail.com> | 2019-12-04 23:16:02 -0800 |
|---|---|---|
| committer | Colin Kennedy <colinvfx@gmail.com> | 2019-12-04 23:16:02 -0800 |
| commit | 39a007c8843809696f03f05612dec4433ac0cab4 (patch) | |
| tree | 85fc5173b8530bdc1b78863994f8738863b56076 /tests/test_usd.py | |
| parent | 276eac7704a2ef302378eeeb13117531f135bf44 (diff) | |
| download | pygments-git-39a007c8843809696f03f05612dec4433ac0cab4.tar.gz | |
Updated unittests to make sure outer-text-pair matches are not matched a string types
Diffstat (limited to 'tests/test_usd.py')
| -rw-r--r-- | tests/test_usd.py | 57 |
1 files changed, 55 insertions, 2 deletions
diff --git a/tests/test_usd.py b/tests/test_usd.py index ff590dd3..3b2ecb20 100644 --- a/tests/test_usd.py +++ b/tests/test_usd.py @@ -38,7 +38,7 @@ class Features(_Common): "@./some/path/to/a/file/foo.usda@", "@/some/path/to/a/file/foo.usda@", "@some/path/to/a/file/foo.usda@", - r"@file://SPECI__Z-_ALIZED(syntax_here)?with_arbitrary@#)(%*&)\characters.tar.gz@", + r"@file://SPECI__Z-_ALIZED(syntax_here)?with_arbitrary#)(%*&)\characters.tar.gz@", ]: expected = [ (token.String.Interpol, path), @@ -392,7 +392,10 @@ class Features(_Common): (token.Token.Operator, u"="), (token.Token.Text, u" "), (token.Token.Punctuation, u"["), - (token.Token.Literal.String, u'"modelingVariant", "shadingComplexity"'), + (token.Token.Literal.String, u'"modelingVariant"'), + (token.Token.Generic, u','), + (token.Token.Text, u' '), + (token.Token.Literal.String, u'"shadingComplexity"'), (token.Token.Punctuation, u"]"), (token.Token.Text, u"\n"), (token.Token.Punctuation, u")"), @@ -524,3 +527,53 @@ class EdgeCases(_Common): ], self._get(code), ) + + def test_outer_match(self): + """Make sure that text between located between quotes and @@s are not matched.""" + at_sign = "@firststring@ something else @secondstring@" + + self.assertEqual( + [ + (token.Token.Literal.String.Interpol, u'@firststring@'), + (token.Token.Text, u' '), + (token.Token.Generic, u'something'), + (token.Token.Text, u' '), + (token.Token.Generic, u'else'), + (token.Token.Text, u' '), + (token.Token.Literal.String.Interpol, u'@secondstring@'), + (token.Token.Text, u'\n'), + ], + self._get(at_sign) + ) + + single = "'firststring' something else 'secondstring'" + + self.assertEqual( + [ + (token.Token.Literal.String, u"'firststring'"), + (token.Token.Text, u' '), + (token.Token.Generic, u'something'), + (token.Token.Text, u' '), + (token.Token.Generic, u'else'), + (token.Token.Text, u' '), + (token.Token.Literal.String, u"'secondstring'"), + (token.Token.Text, u'\n'), + ], + self._get(single) + ) + + double = "'firststring' something else 'secondstring'" + + self.assertEqual( + [ + (token.Token.Literal.String, u"'firststring'"), + (token.Token.Text, u' '), + (token.Token.Generic, u'something'), + (token.Token.Text, u' '), + (token.Token.Generic, u'else'), + (token.Token.Text, u' '), + (token.Token.Literal.String, u"'secondstring'"), + (token.Token.Text, u'\n'), + ], + self._get(double) + ) |
