]> git.tdb.fi Git - libs/gl.git/blobdiff - tests/glsl/glslcompiler.cpp
Check that errors were generated as expected
[libs/gl.git] / tests / glsl / glslcompiler.cpp
index 7c5e646283c25cfcbbbc8e705e4c958b0c22c6f9..fa6e588ef437d5e9f9455e0c3b8c3f91ce4f1281 100644 (file)
@@ -99,9 +99,9 @@ const GlslCompilerTest::TestCase &GlslCompilerTest::load_test_case(const string
 void GlslCompilerTest::run_test_case(const TestCase *test_case)
 {
        GL::SL::Compiler compiler(GL::SL::Features::all());
-       compiler.set_source(test_case->source, "<test>");
        try
        {
+               compiler.set_source(test_case->source, "<test>");
                compiler.compile(GL::SL::Compiler::PROGRAM);
        }
        catch(const GL::SL::invalid_shader_source &exc)
@@ -116,6 +116,9 @@ void GlslCompilerTest::run_test_case(const TestCase *test_case)
                throw;
        }
 
+       if(!test_case->expected_error.empty())
+               fail("Error expected but none thrown");
+
        auto stages = compiler.get_stages();
        for(auto s: stages)
        {