Add support for running tests that are expected to fail
Also add should-fail tests that exercise const and decl initializers
This commit is contained in:
6
tests_errors/const-1.ispc
Normal file
6
tests_errors/const-1.ispc
Normal file
@@ -0,0 +1,6 @@
|
||||
// Can't pre-increment
|
||||
|
||||
int func() {
|
||||
const int x = 2;
|
||||
++x;
|
||||
}
|
||||
6
tests_errors/const-2.ispc
Normal file
6
tests_errors/const-2.ispc
Normal file
@@ -0,0 +1,6 @@
|
||||
// Can't assign to type
|
||||
|
||||
int func() {
|
||||
const int x = 2;
|
||||
x = 0;
|
||||
}
|
||||
9
tests_errors/const-3.ispc
Normal file
9
tests_errors/const-3.ispc
Normal file
@@ -0,0 +1,9 @@
|
||||
// Can't assign to type
|
||||
|
||||
struct Foo {
|
||||
int x;
|
||||
};
|
||||
|
||||
int func(const Foo f) {
|
||||
f.x = 0;
|
||||
}
|
||||
9
tests_errors/const-4.ispc
Normal file
9
tests_errors/const-4.ispc
Normal file
@@ -0,0 +1,9 @@
|
||||
// Can't assign to type
|
||||
|
||||
struct Foo {
|
||||
int x;
|
||||
};
|
||||
|
||||
int func(const int f) {
|
||||
f -= 2;
|
||||
}
|
||||
6
tests_errors/const-5.ispc
Normal file
6
tests_errors/const-5.ispc
Normal file
@@ -0,0 +1,6 @@
|
||||
// Can't assign to type
|
||||
|
||||
int func() {
|
||||
const int a[10] = {1,2,3,4,5,6,7,8,9,10};
|
||||
a[0] = 1;
|
||||
}
|
||||
5
tests_errors/decl-1.ispc
Normal file
5
tests_errors/decl-1.ispc
Normal file
@@ -0,0 +1,5 @@
|
||||
// requires 10 values; 11 provided
|
||||
|
||||
int func() {
|
||||
int a[10] = {1,2,3,4,5,6,7,8,9,10,11};
|
||||
}
|
||||
5
tests_errors/decl-2.ispc
Normal file
5
tests_errors/decl-2.ispc
Normal file
@@ -0,0 +1,5 @@
|
||||
// requires 12 values; 11 provided
|
||||
|
||||
int func() {
|
||||
int a[12] = {1,2,3,4,5,6,7,8,9,10,11};
|
||||
}
|
||||
5
tests_errors/decl-3.ispc
Normal file
5
tests_errors/decl-3.ispc
Normal file
@@ -0,0 +1,5 @@
|
||||
// Expression list initializers can't be used
|
||||
|
||||
int func() {
|
||||
int a = { 1 };
|
||||
}
|
||||
5
tests_errors/decl-4.ispc
Normal file
5
tests_errors/decl-4.ispc
Normal file
@@ -0,0 +1,5 @@
|
||||
// Can't declare an unsized array as a local variable without providing an initializer expression to set its size
|
||||
|
||||
int func() {
|
||||
int a[];
|
||||
}
|
||||
Reference in New Issue
Block a user