From 5b49974bd6ddd248b5ee1b1e29c0acfc3c422a3a Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Mon, 12 Jun 2017 12:42:17 -0700 Subject: Rename tests from `*.spire` to `*.slang` Many of the existing test cases were being skipped on accident, because their file names used `.spire` and the test tool was now looking for `.slang` --- tests/front-end/lexer-comments.slang | 13 +++++ tests/front-end/lexer-comments.spire | 13 ----- tests/front-end/parser-decls.slang | 60 ++++++++++++++++++++++ tests/front-end/parser-decls.spire | 60 ---------------------- tests/front-end/parser-empty.slang | 1 + tests/front-end/parser-empty.spire | 1 - tests/front-end/parser-error-unclosed-curly.slang | 3 ++ .../parser-error-unclosed-curly.slang.expected | 6 +++ tests/front-end/parser-error-unclosed-curly.spire | 3 -- .../parser-error-unclosed-curly.spire.expected | 6 --- tests/front-end/parser-using-file-a.slang.h | 3 ++ tests/front-end/parser-using-file-a.spireh | 3 -- tests/front-end/parser-using-file.spire.disabled | 2 +- tests/front-end/pipeline-simple.slang.h | 41 +++++++++++++++ tests/front-end/pipeline-simple.spireh | 41 --------------- tests/front-end/struct.slang | 49 ++++++++++++++++++ tests/front-end/struct.spire | 49 ------------------ tests/front-end/typedef.slang | 15 ++++++ tests/front-end/typedef.spire | 15 ------ 19 files changed, 192 insertions(+), 192 deletions(-) create mode 100644 tests/front-end/lexer-comments.slang delete mode 100644 tests/front-end/lexer-comments.spire create mode 100644 tests/front-end/parser-decls.slang delete mode 100644 tests/front-end/parser-decls.spire create mode 100644 tests/front-end/parser-empty.slang delete mode 100644 tests/front-end/parser-empty.spire create mode 100644 tests/front-end/parser-error-unclosed-curly.slang create mode 100644 tests/front-end/parser-error-unclosed-curly.slang.expected delete mode 100644 tests/front-end/parser-error-unclosed-curly.spire delete mode 100644 tests/front-end/parser-error-unclosed-curly.spire.expected create mode 100644 tests/front-end/parser-using-file-a.slang.h delete mode 100644 tests/front-end/parser-using-file-a.spireh create mode 100644 tests/front-end/pipeline-simple.slang.h delete mode 100644 tests/front-end/pipeline-simple.spireh create mode 100644 tests/front-end/struct.slang delete mode 100644 tests/front-end/struct.spire create mode 100644 tests/front-end/typedef.slang delete mode 100644 tests/front-end/typedef.spire (limited to 'tests/front-end') diff --git a/tests/front-end/lexer-comments.slang b/tests/front-end/lexer-comments.slang new file mode 100644 index 000000000..d8c06ca76 --- /dev/null +++ b/tests/front-end/lexer-comments.slang @@ -0,0 +1,13 @@ +//TEST:SIMPLE: +// confirming that the lexer handles comments correctly + +// line comment + +/* block comment +*/ + +/* block comments don't nest + /* +*/ + +float f(float f) { return f; } \ No newline at end of file diff --git a/tests/front-end/lexer-comments.spire b/tests/front-end/lexer-comments.spire deleted file mode 100644 index d8c06ca76..000000000 --- a/tests/front-end/lexer-comments.spire +++ /dev/null @@ -1,13 +0,0 @@ -//TEST:SIMPLE: -// confirming that the lexer handles comments correctly - -// line comment - -/* block comment -*/ - -/* block comments don't nest - /* -*/ - -float f(float f) { return f; } \ No newline at end of file diff --git a/tests/front-end/parser-decls.slang b/tests/front-end/parser-decls.slang new file mode 100644 index 000000000..bc5a2b13b --- /dev/null +++ b/tests/front-end/parser-decls.slang @@ -0,0 +1,60 @@ +//TEST:SIMPLE: +// test that we can parse all the expected kinds of declarations + +// global-scope `using` is another test + +/* Note(tfoley): disabled during syntax transition +// pipeline +pipeline P +{ + +} +*/ + +// empty declaration +; + +// struct type +struct Pair +{ + int head; + float tail; + +// Note(tfoley): semicolon is expected/required +// here for compatibility with HLSL (C-style +// declarators). +// +// TODO: this could be removed if we treat +// HLSL as a "compatibility mode" +}; + +// function at global scope +float tail(Pair p) { return p.tail; } + +/* Note(tfoley): disabled during syntax transition + +// module +module M +{ + // component declarations + + // using declarations + +} + +// a module can "inherit" from a pipeline +module M2 + targets P +{ +} + +// shader +shader S +{ + // component declarations + + // using declarations + +} + +*/ \ No newline at end of file diff --git a/tests/front-end/parser-decls.spire b/tests/front-end/parser-decls.spire deleted file mode 100644 index bc5a2b13b..000000000 --- a/tests/front-end/parser-decls.spire +++ /dev/null @@ -1,60 +0,0 @@ -//TEST:SIMPLE: -// test that we can parse all the expected kinds of declarations - -// global-scope `using` is another test - -/* Note(tfoley): disabled during syntax transition -// pipeline -pipeline P -{ - -} -*/ - -// empty declaration -; - -// struct type -struct Pair -{ - int head; - float tail; - -// Note(tfoley): semicolon is expected/required -// here for compatibility with HLSL (C-style -// declarators). -// -// TODO: this could be removed if we treat -// HLSL as a "compatibility mode" -}; - -// function at global scope -float tail(Pair p) { return p.tail; } - -/* Note(tfoley): disabled during syntax transition - -// module -module M -{ - // component declarations - - // using declarations - -} - -// a module can "inherit" from a pipeline -module M2 - targets P -{ -} - -// shader -shader S -{ - // component declarations - - // using declarations - -} - -*/ \ No newline at end of file diff --git a/tests/front-end/parser-empty.slang b/tests/front-end/parser-empty.slang new file mode 100644 index 000000000..bfd66f05b --- /dev/null +++ b/tests/front-end/parser-empty.slang @@ -0,0 +1 @@ +//TEST:SIMPLE: diff --git a/tests/front-end/parser-empty.spire b/tests/front-end/parser-empty.spire deleted file mode 100644 index bfd66f05b..000000000 --- a/tests/front-end/parser-empty.spire +++ /dev/null @@ -1 +0,0 @@ -//TEST:SIMPLE: diff --git a/tests/front-end/parser-error-unclosed-curly.slang b/tests/front-end/parser-error-unclosed-curly.slang new file mode 100644 index 000000000..6cfcca456 --- /dev/null +++ b/tests/front-end/parser-error-unclosed-curly.slang @@ -0,0 +1,3 @@ +//TEST:SIMPLE: +void foo() { +// Note: no closing curly brace diff --git a/tests/front-end/parser-error-unclosed-curly.slang.expected b/tests/front-end/parser-error-unclosed-curly.slang.expected new file mode 100644 index 000000000..379557108 --- /dev/null +++ b/tests/front-end/parser-error-unclosed-curly.slang.expected @@ -0,0 +1,6 @@ +result code = -1 +standard error = { +tests/front-end/parser-error-unclosed-curly.slang(4): error 20001: unexpected end of file, expected '}' +} +standard output = { +} diff --git a/tests/front-end/parser-error-unclosed-curly.spire b/tests/front-end/parser-error-unclosed-curly.spire deleted file mode 100644 index 6cfcca456..000000000 --- a/tests/front-end/parser-error-unclosed-curly.spire +++ /dev/null @@ -1,3 +0,0 @@ -//TEST:SIMPLE: -void foo() { -// Note: no closing curly brace diff --git a/tests/front-end/parser-error-unclosed-curly.spire.expected b/tests/front-end/parser-error-unclosed-curly.spire.expected deleted file mode 100644 index 437b6eab0..000000000 --- a/tests/front-end/parser-error-unclosed-curly.spire.expected +++ /dev/null @@ -1,6 +0,0 @@ -result code = -1 -standard error = { -Tests/FrontEnd/parser-error-unclosed-curly.spire(4): error 20001: unexpected end of file, expected '}' -} -standard output = { -} diff --git a/tests/front-end/parser-using-file-a.slang.h b/tests/front-end/parser-using-file-a.slang.h new file mode 100644 index 000000000..62e6acd06 --- /dev/null +++ b/tests/front-end/parser-using-file-a.slang.h @@ -0,0 +1,3 @@ +// this file exists to be included by "parser-using-file.spire" + +float a(float x) { return x * x; } diff --git a/tests/front-end/parser-using-file-a.spireh b/tests/front-end/parser-using-file-a.spireh deleted file mode 100644 index 62e6acd06..000000000 --- a/tests/front-end/parser-using-file-a.spireh +++ /dev/null @@ -1,3 +0,0 @@ -// this file exists to be included by "parser-using-file.spire" - -float a(float x) { return x * x; } diff --git a/tests/front-end/parser-using-file.spire.disabled b/tests/front-end/parser-using-file.spire.disabled index f93fb576c..b2e1648f7 100644 --- a/tests/front-end/parser-using-file.spire.disabled +++ b/tests/front-end/parser-using-file.spire.disabled @@ -1,6 +1,6 @@ //TEST:SIMPLE: // test that we can include a file via `using` -using "parser-using-file-a.spireh"; +using "parser-using-file-a.slang.h"; float base( float x ) { return a(x); } \ No newline at end of file diff --git a/tests/front-end/pipeline-simple.slang.h b/tests/front-end/pipeline-simple.slang.h new file mode 100644 index 000000000..6a6dc1b1c --- /dev/null +++ b/tests/front-end/pipeline-simple.slang.h @@ -0,0 +1,41 @@ +// pipeline-simple.slang.h + + +// TODO(tfoley): strip this down to a minimal pipeline + +pipeline StandardPipeline +{ + [Pinned] + input world MeshVertex; + + world CoarseVertex;// : "glsl(vertex:projCoord)" using projCoord export standardExport; + world Fragment;// : "glsl" export fragmentExport; + + require @CoarseVertex vec4 projCoord; + + [VertexInput] + extern @CoarseVertex MeshVertex vertAttribIn; + import(MeshVertex->CoarseVertex) vertexImport() + { + return project(vertAttribIn); + } + + extern @Fragment CoarseVertex CoarseVertexIn; + import(CoarseVertex->Fragment) standardImport() +// TODO(tfoley): this trait doesn't seem to be implemented on `vec3` +// require trait IsTriviallyPassable(CoarseVertex) + { + return project(CoarseVertexIn); + } + + stage vs : VertexShader + { + World: CoarseVertex; + Position: projCoord; + } + + stage fs : FragmentShader + { + World: Fragment; + } +} \ No newline at end of file diff --git a/tests/front-end/pipeline-simple.spireh b/tests/front-end/pipeline-simple.spireh deleted file mode 100644 index 55afd693c..000000000 --- a/tests/front-end/pipeline-simple.spireh +++ /dev/null @@ -1,41 +0,0 @@ -// pipeline-simple.spireh - - -// TODO(tfoley): strip this down to a minimal pipeline - -pipeline StandardPipeline -{ - [Pinned] - input world MeshVertex; - - world CoarseVertex;// : "glsl(vertex:projCoord)" using projCoord export standardExport; - world Fragment;// : "glsl" export fragmentExport; - - require @CoarseVertex vec4 projCoord; - - [VertexInput] - extern @CoarseVertex MeshVertex vertAttribIn; - import(MeshVertex->CoarseVertex) vertexImport() - { - return project(vertAttribIn); - } - - extern @Fragment CoarseVertex CoarseVertexIn; - import(CoarseVertex->Fragment) standardImport() -// TODO(tfoley): this trait doesn't seem to be implemented on `vec3` -// require trait IsTriviallyPassable(CoarseVertex) - { - return project(CoarseVertexIn); - } - - stage vs : VertexShader - { - World: CoarseVertex; - Position: projCoord; - } - - stage fs : FragmentShader - { - World: Fragment; - } -} \ No newline at end of file diff --git a/tests/front-end/struct.slang b/tests/front-end/struct.slang new file mode 100644 index 000000000..16b1bebc7 --- /dev/null +++ b/tests/front-end/struct.slang @@ -0,0 +1,49 @@ +//TEST:SIMPLE: +// test that `struct` decls work + +// Note(tfoley): disabled during syntax transition +// #include "pipeline-simple.slang.h" + +// struct declaration +struct Foo +{ + float3 a; + float3 b; +}; + +// function on a struct +Foo makeFoo(float x, float y) +{ + // local of struct type + Foo foo; + foo.a = float3(x); + foo.b = float3(y); + return foo; +} + +/* Note(tfoley): disabled during syntax transition + +template shader Test() +// targets StandardPipeline +{ + // Uniform of struct type + param Foo foo1; + + @MeshVertex float3 position; + @MeshVertex float3 color; + + param mat4 modelViewProjection; + + public vec4 projCoord = modelViewProjection * vec4(position, 1.0); + + // Component of struct type + // Note(tfoley): use of `public` here required to work around parser limitations + public Foo foo2 = makeFoo(color.x, color.y); + + // + float3 result = foo1.a + foo2.b; + + out @Fragment vec4 colorTarget = vec4(result,1); +} + +*/ \ No newline at end of file diff --git a/tests/front-end/struct.spire b/tests/front-end/struct.spire deleted file mode 100644 index 8347f8d58..000000000 --- a/tests/front-end/struct.spire +++ /dev/null @@ -1,49 +0,0 @@ -//TEST:SIMPLE: -// test that `struct` decls work - -// Note(tfoley): disabled during syntax transition -// #include "pipeline-simple.spireh" - -// struct declaration -struct Foo -{ - float3 a; - float3 b; -}; - -// function on a struct -Foo makeFoo(float x, float y) -{ - // local of struct type - Foo foo; - foo.a = float3(x); - foo.b = float3(y); - return foo; -} - -/* Note(tfoley): disabled during syntax transition - -template shader Test() -// targets StandardPipeline -{ - // Uniform of struct type - param Foo foo1; - - @MeshVertex float3 position; - @MeshVertex float3 color; - - param mat4 modelViewProjection; - - public vec4 projCoord = modelViewProjection * vec4(position, 1.0); - - // Component of struct type - // Note(tfoley): use of `public` here required to work around parser limitations - public Foo foo2 = makeFoo(color.x, color.y); - - // - float3 result = foo1.a + foo2.b; - - out @Fragment vec4 colorTarget = vec4(result,1); -} - -*/ \ No newline at end of file diff --git a/tests/front-end/typedef.slang b/tests/front-end/typedef.slang new file mode 100644 index 000000000..7e96bead0 --- /dev/null +++ b/tests/front-end/typedef.slang @@ -0,0 +1,15 @@ +//TEST:SIMPLE: +// test that we can `typedef` a type + +typedef float F32; + +F32 foo() +{ + float x = 123.0; + return x; +} + +float bar() +{ + return foo(); +} diff --git a/tests/front-end/typedef.spire b/tests/front-end/typedef.spire deleted file mode 100644 index 7e96bead0..000000000 --- a/tests/front-end/typedef.spire +++ /dev/null @@ -1,15 +0,0 @@ -//TEST:SIMPLE: -// test that we can `typedef` a type - -typedef float F32; - -F32 foo() -{ - float x = 123.0; - return x; -} - -float bar() -{ - return foo(); -} -- cgit v1.2.3