summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McCabe <zen3d.linux@gmail.com>2011-08-21 18:27:57 -0700
committerIan Romanick <ian.d.romanick@intel.com>2011-08-25 07:55:23 -0700
commit2113c1fa00c800fbf7e5301e76847ee4d2f587f8 (patch)
tree3b9ad2affb25c91fd03763dae37b6f3a453b2db2
parent6a8cf41c59e3a8e17b4670eea2a4253940e0001a (diff)
glsl-1.30: Add compile tests for switch statements
Included are tests that test both positvely and negatively that the compiler processed valid switch statements and detected syntax errors. Signed-off-by: Dan McCabe <zen3d.linux@gmail.com> Signed-off-by: Ian Romanick <ian.d.romanick@intel.com>
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-case-const-int-expression.vert28
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-case-const-int.vert25
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-case-empty-end.vert19
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-case-fallthrough.vert29
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-case-in-int.vert27
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-case-statement.vert29
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-case-uniform-int.vert27
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-default.vert24
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-const-float.vert18
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-const-int.vert18
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-const-vec2.vert18
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-in-float.vert20
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-in-int.vert20
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-in-vec2.vert20
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-uniform-float.vert20
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-uniform-int.vert20
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-uniform-vec2.vert20
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-var-float.vert19
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-var-int.vert19
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-var-vec2.vert19
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-break.vert27
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-case.vert24
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-default.vert22
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-loop.vert22
-rw-r--r--tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-switch.vert20
25 files changed, 554 insertions, 0 deletions
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-const-int-expression.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-const-int-expression.vert
new file mode 100644
index 000000000..61c6e6551
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-const-int-expression.vert
@@ -0,0 +1,28 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "The type of init-expression in a switch statement must be a scalar
+// integer. If a case label has a constant- expression of equal value,
+// then execution will continue after that label."
+//
+// The spec doesn't actually say anything about the type of cases. It only
+// says "constant-expression".
+
+#version 130
+
+#define one 1
+#define two 2
+
+void main() {
+ int tmp = 0;
+ switch (1) {
+ case one + two:
+ tmp = 1;
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-const-int.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-const-int.vert
new file mode 100644
index 000000000..33ec4a9ea
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-const-int.vert
@@ -0,0 +1,25 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "The type of init-expression in a switch statement must be a scalar
+// integer. If a case label has a constant- expression of equal value,
+// then execution will continue after that label."
+//
+// The spec doesn't actually say anything about the type of cases. It only
+// says "constant-expression".
+
+#version 130
+
+void main() {
+ int tmp = 0;
+ switch (1) {
+ case 0:
+ tmp = 1;
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-empty-end.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-empty-end.vert
new file mode 100644
index 000000000..153a533d1
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-empty-end.vert
@@ -0,0 +1,19 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "Fall through labels are allowed, but it is an error to have no
+// statement between a label and the end of the switch statement."
+
+#version 130
+
+void main() {
+ switch (1) {
+ case 0:
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-fallthrough.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-fallthrough.vert
new file mode 100644
index 000000000..5af422a73
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-fallthrough.vert
@@ -0,0 +1,29 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "The type of init-expression in a switch statement must be a scalar
+// integer. If a case label has a constant- expression of equal value,
+// then execution will continue after that label...Fall through labels are
+// allowed, but it is an error to have no statement between a label and
+// the end of the switch statement."
+//
+// The spec doesn't actually say anything about the type of cases. It only
+// says "constant-expression".
+
+#version 130
+
+void main() {
+ int tmp = 0;
+ switch (1) {
+ case 1:
+ tmp = 1;
+ default:
+ tmp = 0;
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-in-int.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-in-int.vert
new file mode 100644
index 000000000..2343c214f
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-in-int.vert
@@ -0,0 +1,27 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "The type of init-expression in a switch statement must be a scalar
+// integer. If a case label has a constant- expression of equal value,
+// then execution will continue after that label."
+//
+// The spec doesn't actually say anything about the type of cases. It only
+// says "constant-expression".
+
+#version 130
+
+in int v;
+
+void main() {
+ int tmp = 0;
+ switch (1) {
+ case v:
+ tmp = 1;
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-statement.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-statement.vert
new file mode 100644
index 000000000..c501219ee
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-statement.vert
@@ -0,0 +1,29 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "The type of init-expression in a switch statement must be a scalar
+// integer. If a case label has a constant- expression of equal value,
+// then execution will continue after that label."
+//
+// The spec doesn't actually say anything about the type of cases. It only
+// says "constant-expression".
+
+#version 130
+
+void main() {
+ int tmp = 0;
+ switch (1) {
+ case 0:
+ tmp = 1;
+ break;
+ default:
+ tmp = 2;
+ break;
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-uniform-int.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-uniform-int.vert
new file mode 100644
index 000000000..d9546bffd
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-case-uniform-int.vert
@@ -0,0 +1,27 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "The type of init-expression in a switch statement must be a scalar
+// integer. If a case label has a constant- expression of equal value,
+// then execution will continue after that label."
+//
+// The spec doesn't actually say anything about the type of cases. It only
+// says "constant-expression".
+
+#version 130
+
+uniform int src;
+
+void main() {
+ int tmp = 0;
+ switch (1) {
+ case src:
+ tmp = 1;
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-default.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-default.vert
new file mode 100644
index 000000000..14f0d5392
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-default.vert
@@ -0,0 +1,24 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "Otherwise, if there is a default label, execution will continue after
+// that label....It is an error to have more than one default or a
+// replicated constant-expression....Fall through labels are allowed, but
+// it is an error to have no statement between a label and the end of the
+// switch statement."
+
+#version 130
+
+void main() {
+ int tmp = 0;
+ switch (1) {
+ default:
+ tmp = 1;
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-const-float.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-const-float.vert
new file mode 100644
index 000000000..a441cfbbb
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-const-float.vert
@@ -0,0 +1,18 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "The type of init-expression in a switch statement must be a scalar
+// integer."
+
+#version 130
+
+void main() {
+ switch (1.5) {
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-const-int.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-const-int.vert
new file mode 100644
index 000000000..4b2be86f2
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-const-int.vert
@@ -0,0 +1,18 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "The type of init-expression in a switch statement must be a scalar
+// integer."
+
+#version 130
+
+void main() {
+ switch (1) {
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-const-vec2.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-const-vec2.vert
new file mode 100644
index 000000000..a5560ad8b
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-const-vec2.vert
@@ -0,0 +1,18 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "The type of init-expression in a switch statement must be a scalar
+// integer."
+
+#version 130
+
+void main() {
+ switch (vec2(0, 0)) {
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-in-float.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-in-float.vert
new file mode 100644
index 000000000..e0e158f29
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-in-float.vert
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "The type of init-expression in a switch statement must be a scalar
+// integer."
+
+#version 130
+
+in float src;
+
+void main() {
+ switch (src) {
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-in-int.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-in-int.vert
new file mode 100644
index 000000000..965d05177
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-in-int.vert
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "The type of init-expression in a switch statement must be a scalar
+// integer."
+
+#version 130
+
+in int src;
+
+void main() {
+ switch (src) {
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-in-vec2.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-in-vec2.vert
new file mode 100644
index 000000000..2c274af1f
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-in-vec2.vert
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "The type of init-expression in a switch statement must be a scalar
+// integer."
+
+#version 130
+
+in vec2 src;
+
+void main() {
+ switch (src) {
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-uniform-float.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-uniform-float.vert
new file mode 100644
index 000000000..8d7887f06
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-uniform-float.vert
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "The type of init-expression in a switch statement must be a scalar
+// integer."
+
+#version 130
+
+uniform float src;
+
+void main() {
+ switch (src) {
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-uniform-int.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-uniform-int.vert
new file mode 100644
index 000000000..747bed3eb
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-uniform-int.vert
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "The type of init-expression in a switch statement must be a scalar
+// integer."
+
+#version 130
+
+uniform int src;
+
+void main() {
+ switch (src) {
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-uniform-vec2.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-uniform-vec2.vert
new file mode 100644
index 000000000..cdf5a8eed
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-uniform-vec2.vert
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "The type of init-expression in a switch statement must be a scalar
+// integer."
+
+#version 130
+
+uniform vec2 src;
+
+void main() {
+ switch (src) {
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-var-float.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-var-float.vert
new file mode 100644
index 000000000..4e2eddad0
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-var-float.vert
@@ -0,0 +1,19 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "The type of init-expression in a switch statement must be a scalar
+// integer."
+
+#version 130
+
+void main() {
+ float tmp = 1.5;
+ switch (tmp) {
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-var-int.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-var-int.vert
new file mode 100644
index 000000000..4119c690d
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-var-int.vert
@@ -0,0 +1,19 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "The type of init-expression in a switch statement must be a scalar
+// integer."
+
+#version 130
+
+void main() {
+ int tmp = 5;
+ switch (tmp) {
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-var-vec2.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-var-vec2.vert
new file mode 100644
index 000000000..4a0748d3c
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-expression-var-vec2.vert
@@ -0,0 +1,19 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "The type of init-expression in a switch statement must be a scalar
+// integer."
+
+#version 130
+
+void main() {
+ vec2 tmp = vec2(0, 0);
+ switch (tmp) {
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-break.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-break.vert
new file mode 100644
index 000000000..209b1bdbd
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-break.vert
@@ -0,0 +1,27 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// [end config]
+//
+// From page 59 (page 65 of the PDF) of the GLSL 1.30 spec:
+//
+// "The break jump can also be used only in loops and switch
+// statements. It is simply an immediate exit of the inner-most loop or
+// switch statements containing the break."
+
+#version 130
+
+void main() {
+ int tmp = 0;
+ switch (1) {
+ case 1:
+ while (tmp < 8) {
+ if (tmp > 4)
+ break;
+ tmp += 1;
+ }
+ break;
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-case.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-case.vert
new file mode 100644
index 000000000..f93126e6d
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-case.vert
@@ -0,0 +1,24 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "No case or default labels can be nested inside other flow control
+// nested within their corresponding switch."
+
+#version 130
+
+void main() {
+ int tmp = 0;
+ switch (1) {
+ case 0:
+ while (1) {
+ case 1:
+ tmp = 1;
+ }
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-default.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-default.vert
new file mode 100644
index 000000000..43e439f84
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-default.vert
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: fail
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "No case or default labels can be nested inside other flow control
+// nested within their corresponding switch."
+
+#version 130
+
+void main() {
+ switch (1) {
+ case 0:
+ while (1) {
+ default:
+ }
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-loop.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-loop.vert
new file mode 100644
index 000000000..1653b6571
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-loop.vert
@@ -0,0 +1,22 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "Conditionals can be nested."
+
+#version 130
+
+void main() {
+ int tmp = 0;
+ switch (1) {
+ case 1:
+ while (tmp < 8) {
+ tmp += 1;
+ }
+ }
+
+ gl_Position = vec4(0.0);
+}
diff --git a/tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-switch.vert b/tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-switch.vert
new file mode 100644
index 000000000..c2f14a134
--- /dev/null
+++ b/tests/spec/glsl-1.30/compiler/switch-statement/switch-nested-switch.vert
@@ -0,0 +1,20 @@
+// [config]
+// expect_result: pass
+// glsl_version: 1.30
+// [end config]
+//
+// From page 57 (page 63 of the PDF) of the GLSL 1.30 spec:
+//
+// "Conditionals can be nested."
+
+#version 130
+
+void main() {
+ switch (1) {
+ case 0:
+ switch (0) {
+ }
+ }
+
+ gl_Position = vec4(0.0);
+}