[Piglit] [patch v3 06/15] move: glsl_parser_test.py: an empty // should be okay

Dylan Baker baker.dylan.c at gmail.com
Mon Jul 28 17:34:16 PDT 2014


This patch ensures that a blank line '//\n' is valid explicitly rather
than implicitly relying on it working.

Signed-off-by: Dylan Baker <baker.dylan.c at gmail.com>
---
 framework/glsl_parser_test.py             |  2 +-
 framework/tests/glsl_parser_test_tests.py | 16 ++++++++++++++++
 2 files changed, 17 insertions(+), 1 deletion(-)

diff --git a/framework/glsl_parser_test.py b/framework/glsl_parser_test.py
index 624df68..78d4ca8 100644
--- a/framework/glsl_parser_test.py
+++ b/framework/glsl_parser_test.py
@@ -158,7 +158,7 @@ class GLSLParserTest(PiglitTest):
 
             # If strip renendered '' that means we had a blank newline,
             # just go on
-            if line == '':
+            if line in ['', '//']:
                 continue
             # If we get to the end of the config break
             elif is_header.match(line):
diff --git a/framework/tests/glsl_parser_test_tests.py b/framework/tests/glsl_parser_test_tests.py
index 8d521d2..b4e9c24 100644
--- a/framework/tests/glsl_parser_test_tests.py
+++ b/framework/tests/glsl_parser_test_tests.py
@@ -141,6 +141,22 @@ def test_blank_in_config():
                         "parsed.")
 
 
+def test_empty_in_config():
+    """ C++ sytle comments can have blank commented lines """
+    content = ('// [config]\n'
+               '//\n'
+               '// expect_result: pass\n'
+               '// glsl_version: 1.00\n'
+               '// [end config]\n')
+
+    test, name = _check_config(content)
+
+    nt.assert_equal(test.command, [os.path.join(TEST_BIN_DIR, 'glslparsertest'),
+                                   name, 'pass', '1.00'],
+                    msg="A blank commented line in a C++ style comment was not"
+                        " properly parsed.")
+
+
 def test_glslparser_initializer():
     """ GLSLParserTest initializes """
     glsl.GLSLParserTest('tests/spec/glsl-es-1.00/compiler/version-macro.frag')
-- 
2.0.2



More information about the Piglit mailing list