Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Refactoring] merge test cases to reduce files
- Loading branch information
Showing
26 changed files
with
262 additions
and
348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/diag8777.d(12): Error: constructor diag8777.Foo1.this missing initializer for immutable field x | ||
fail_compilation/diag8777.d(12): Error: constructor diag8777.Foo1.this missing initializer for const field y | ||
--- | ||
*/ | ||
class Foo1 | ||
{ | ||
immutable int[5] x; | ||
const int[5] y; | ||
this() {} | ||
} | ||
|
||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/diag8777.d(25): Error: cannot modify immutable expression x | ||
fail_compilation/diag8777.d(28): Error: cannot modify const expression y | ||
--- | ||
*/ | ||
void test2() | ||
{ | ||
immutable int x; | ||
x = 1; | ||
|
||
const int y; | ||
y = 1; | ||
} | ||
|
||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/diag8777.d(42): Error: cannot remove key from immutable associative array hashx | ||
fail_compilation/diag8777.d(43): Error: cannot remove key from const associative array hashy | ||
--- | ||
*/ | ||
immutable(int[int]) hashx; | ||
const(int[int]) hashy; | ||
void test3() | ||
{ | ||
hashx.remove(1); | ||
hashy.remove(1); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,90 @@ | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/fail163.d(13): Error: cannot implicitly convert expression (q) of type const(char)[] to char[] | ||
fail_compilation/fail163.d(11): Error: cannot implicitly convert expression (q) of type const(char)[] to char[] | ||
--- | ||
*/ | ||
|
||
void foo() | ||
void test1() | ||
{ | ||
char[] p; | ||
const(char)[] q; | ||
|
||
p = q; | ||
} | ||
|
||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/fail163.d(24): Error: cannot implicitly convert expression (p) of type const(int***) to const(int)*** | ||
--- | ||
*/ | ||
void test2() | ||
{ | ||
const int*** p; | ||
const(int)*** cp; | ||
cp = p; | ||
} | ||
|
||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/fail163.d(37): Error: cannot modify const expression p | ||
--- | ||
*/ | ||
void test3() | ||
{ | ||
const(uint***) p; | ||
const(int)*** cp; | ||
p = cp; | ||
} | ||
|
||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/fail163.d(50): Error: cannot implicitly convert expression (cp) of type const(int)***[] to const(uint***)[] | ||
--- | ||
*/ | ||
void test4() | ||
{ | ||
const(uint***)[] p; | ||
const(int)***[] cp; | ||
p = cp; | ||
} | ||
|
||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/fail163.d(63): Error: cannot modify const expression *p | ||
--- | ||
*/ | ||
void test5() | ||
{ | ||
int x; | ||
const(int)* p = &x; | ||
*p = 3; | ||
} | ||
|
||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/fail163.d(76): Error: cannot implicitly convert expression (& x) of type int* to immutable(int)* | ||
fail_compilation/fail163.d(77): Error: cannot modify immutable expression *p | ||
--- | ||
*/ | ||
void test6() | ||
{ | ||
int x; | ||
immutable(int)* p = &x; | ||
*p = 3; | ||
} | ||
|
||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/fail163.d(89): Error: cannot implicitly convert expression (& x) of type const(int)* to int* | ||
--- | ||
*/ | ||
void test7() | ||
{ | ||
const(int) x = 3; | ||
int* p = &x; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,20 @@ | ||
/* | ||
TEST_OUTPUT: | ||
--- | ||
fail_compilation/fail176.d(13): Error: cannot modify immutable expression b[1] | ||
fail_compilation/fail176.d(13): Error: cannot modify immutable expression a[1] | ||
fail_compilation/fail176.d(16): Error: cannot modify immutable expression b[1] | ||
fail_compilation/fail176.d(19): Error: cannot modify const expression c[1] | ||
--- | ||
*/ | ||
|
||
void foo() | ||
{ | ||
auto a = "abc"; | ||
a[1] = 'd'; | ||
|
||
immutable char[3] b = "abc"; | ||
//const char[3] b = "abc"; | ||
b[1] = 'd'; | ||
|
||
const char[3] c = "abc"; | ||
c[1] = 'd'; | ||
} |
Oops, something went wrong.