class TestDashCapEStdinErrors(expect.ErrorMessage): """Tests that -E outputs error messages correctly for stdin input.""" shader = StdinShader('''#version 310 es #extension s enable // missing : void main() { } ''') expected_error = [ '<stdin>:2: error: \'#extension\' : \':\' missing after extension', ' name\n', '1 error generated.\n' ] glslc_args = ['-E', shader]
class TestDashCapEStdin(expect.StdoutMatch): """Tests to make sure -E works with stdin.""" shader = StdinShader('''#version 140 void main() { } ''') expected_stdout = '''#version 140 void main(){ } ''' glslc_args = ['-E', '-fshader-stage=vertex', shader]
class TestDashCapEStdinDoesNotRequireShaderStage(expect.StdoutMatch): """Tests to make sure -E works with stdin even when no shader-stage is specified.""" shader = StdinShader('''#version 140 void main() { } ''') expected_stdout = '''#version 140 void main(){ } ''' glslc_args = ['-E', shader]
class StdinWithoutShaderStage(expect.StdoutMatch, expect.StderrMatch): """Tests that you must use -fshader-stage when specifying - as input.""" shader = StdinShader("""#version 140 int a() { } void main() { int x = a(); } """) glslc_args = [shader] expected_stdout = '' expected_stderr = [ "glslc: error: '-': -fshader-stage required when input is from " 'standard input "-"\n' ]
class StdinErrorMessages(expect.StdoutMatch, expect.StderrMatch): """Tests that error messages using input from stdin are correct.""" shader = StdinShader(""" int a() { } void main() { int x = a(); } """) glslc_args = ['-c', '-fshader-stage=vertex', shader] expected_stdout = '' expected_stderr = [ "<stdin>:2: error: '' : function does not return a value: a\n", '1 error generated.\n' ]
class TestDashCapEMultipleFiles(expect.StdoutMatch): """Tests to make sure -E works with multiple files.""" shader = StdinShader('''#version 140 void main() { } ''') shader2 = FileShader('''#version 140 void function() { } ''', '.vert') expected_stdout = '''#version 140 void main(){ } #version 140 void function(){ } ''' glslc_args = ['-E', '-fshader-stage=vertex', shader, shader2]
class TestDashCapEMultipleFilesWithoutStage(expect.StdoutMatch): """Tests to make sure -E works with multiple files even if we do not specify a stage.""" shader = StdinShader('''#version 140 void main() { } ''') shader2 = FileShader('''#version 140 void function() { } ''', '.glsl') expected_stdout = '''#version 140 void main(){ } #version 140 void function(){ } ''' glslc_args = ['-E', shader, shader2]
class TestPSSWithStdin(expect.ValidObjectFile): """Tests #pragma shader_stage() with stdin.""" shader = StdinShader(VERTEX_ONLY_SHADER_WITH_PRAGMA) glslc_args = ['-c', shader]
class TestDashCapSWithStdIn(expect.ValidAssemblyFile): """Tests that -S works with stdin.""" shader = StdinShader(simple_fragment_shader()) glslc_args = ['-S', '-fshader-stage=fragment', shader]
class VerifyStdinWorks(expect.ValidObjectFile): """Tests glslc accepts vertex shader extension (.vert).""" shader = StdinShader('#version 140\nvoid main() { }') glslc_args = ['-c', '-fshader-stage=vertex', shader]