Add the new test suite.

This test suite has been in use for a long time now, in place of the obsolete and unmanageable testparser.py and testfuncs.py. It verifies the complete optimizer output to stdout and stderr, to ensure that the output matches the expectations.

See unit_tests/README.txt for more info.
This commit is contained in:
Sei Lisa 2019-01-04 20:26:26 +01:00
parent 7fbde0269c
commit 1867dc78e7
547 changed files with 11680 additions and 0 deletions

34
unit_tests/README.txt Normal file
View file

@ -0,0 +1,34 @@
Unit testing suites. These tests are run via run-tests.py.
The testing is performed using the standard Python module 'unittest'. This module accepts some command-line options; we don't add any ourselves. Use 'python run-tests.py -h' for help, or look here for details: https://docs.python.org/2/library/unittest.html#command-line-interface
There are 5 directories defined in the code that contain tests, all of which end in .suite: regression.suite, expr.suite, lso.suite, coverage.suite, preproc.suite.
The files that all 5 contain are the tests themselves. The run-tests.py program reads all .run and .lsl files in each directory and takes them as tests to run.
A test is a series of files all with the same name and with different extensions. Running the test means running the optimizer with the parameters in the .run file (if present), giving it the .lsl file (if present) as input. The output to stdout is compared to the .out file and the output to stderr is compared to the .err file. The test passes if both match and no exception is raised; otherwise it fails.
These are the extensions that the test suite recognizes in more detail:
.lsl: Source file to test. If the first line starts with '// ', then the text in the rest of the line will be set as the docstring for the corresponding test function (visible when requesting verbose coverage).
.run: Command line parameters for the test. Default is: 'main.py -', except in expr.suite which defaults to 'main.py -O clear,optimize,constfold,addstrings,expr -'. The syntax for the parameters is that of the Bourne shell, but '$' expansion is not supported. The 'main.py' part is the value that argv[0] will receive, but is unused otherwise.
.out: Expected stdout resulting from the test. If the first line is REGEX then the rest of the file will be taken as a regular expression to match against, as opposed to matching the whole file contents.
.err: Expected stderr resulting from the test. It also allows regular expression.
.skp: If present, the test will be skipped (not run). The contents of this file are taken as the reason for the expected failure.
.fail: If present, the test will be run, and counted as an expected failure. If a .fail file is present and the test passes, that will be counted as an unexpected success, and the program will not report success at the end. The contents will be ignored; zero-length files are OK.
A test is considered such when either the .lsl or the .run file are present. The default stdin for the program is the .lsl file.
As for the meaning of each subdirectory:
- regression.suite contains normal regression tests.
- expr.suite contains regression tests that apply to expressions.
- lso.suite contains LSO mode tests. Note that LSO support is incomplete.
- coverage.suite contains tests that force certain code paths to execute, in order to maximize the exercised code coverage, even if some tests are trivial and unlikely to cause a regression.
- preproc.suite is for preprocessor-related tests.
As for the files in this directory:
- cat.py just copies standard input to standard output. Used as a preprocessor for some preprocessor tests.
- false.py just terminates with exit code 1.
- output-list.lsl is a utility script that dumps an arbitrary list to local chat, in a format very similar to the one that the expression suite outputs (it may require manual removal of timestamps). Float precision may differ.

View file

@ -0,0 +1,2 @@
event ev()
const list LIST_CONSTANT = []

View file

View file

@ -0,0 +1,21 @@
const key a="\t"
event ev(integer i)
event ev(integer i)
quaternion x(integer i)
void x(integer i)
blah x1(integer i)
integer x2(unknown i)
blah
const vector a = <4,5,3,2>
const vector a = <4,5,3,2
const vector a = <x,4,3>
const vector a = <4,x,3>
const vector a = <3,4,x>
const rotation a = <3,4,4,x>
const list l = []
const quaternion q=<1,2,3,4>
const string v="
const string q="\t"
const unknown x3 = 3
const list L = [1]
const list L2 = [

View file

@ -0,0 +1,5 @@
float llCos( float theta )
integer llModPow( integer a, integer b, integer c )
event timer( )
event no_sensor()
event touch(integer x)

2
unit_tests/cat.py Normal file
View file

@ -0,0 +1,2 @@
import sys
sys.stdout.write(sys.stdin.read())

View file

@ -0,0 +1,9 @@
// Cover auxiliary functions.
default
{
timer()
{
llOwnerSay(llStringToBase64(llList2Key([TEXTURE_BLANK],0)));
llOwnerSay(llStringToBase64(llList2Key([(key)TEXTURE_BLANK],0)));
}
}

View file

@ -0,0 +1,8 @@
default
{
timer()
{
llOwnerSay("NTc0OGRlY2MtZjYyOS00NjFjLTlhMzYtYTM1YTIyMWZlMjFm");
llOwnerSay("NTc0OGRlY2MtZjYyOS00NjFjLTlhMzYtYTM1YTIyMWZlMjFm");
}
}

View file

@ -0,0 +1,9 @@
integer a = 0;
float f = 0.0;
vector v = <0.,0.,0.>;
rotation r = <0.,0.,0.,1.>;
key k = "";
string s = "";
list l = [];
default{state_entry(){}}

View file

@ -0,0 +1,14 @@
integer a;
float f = 0;
vector v = <0, 0, 0>;
rotation r = <0, 0, 0, 1>;
key k = "";
string s = "";
list l = [];
default
{
timer()
{
}
}

View file

@ -0,0 +1 @@
./main.py - -O -dcr

View file

@ -0,0 +1 @@
default{no_sensor(){}}

View file

@ -0,0 +1,6 @@
default
{
timer()
{
}
}

View file

@ -0,0 +1 @@
main.py unit_tests/coverage.suite/existing-filename.lsl

View file

@ -0,0 +1,18 @@
default
{
timer()
{
llModPow(5, 7, 3);
llCos(5);
}
// this one should be kept, as it's not marked as SEF in the test data
no_sensor()
{
}
// this one should disappear
touch(integer k)
{
}
}

View file

@ -0,0 +1,11 @@
default
{
timer()
{
llCos(5);
}
no_sensor()
{
}
}

View file

@ -0,0 +1,2 @@
main.py -b unit_tests/builtins-coverage-5.txt \
-L unit_tests/fndata-coverage-5.txt -

View file

@ -0,0 +1,16 @@
e(){}
integer a;
integer b;
f(){}
g(){}
integer c;
integer d;
h(){}
default
{
timer() {}
touch(integer n) {}
touch_start(integer n) {}
touch_end(integer n) {}
}
state s2{timer(){}}

View file

@ -0,0 +1,47 @@
e()
{
}
integer a;
integer b;
f()
{
}
g()
{
}
integer c;
integer d;
h()
{
}
default
{
timer()
{
}
touch(integer n)
{
}
touch_start(integer n)
{
}
touch_end(integer n)
{
}
}
state s2
{
timer()
{
}
}

View file

@ -0,0 +1 @@
./main.py --prettify -O clear -

View file

@ -0,0 +1,2 @@
REGEX
ProgName -O -DCR,\+BreakCont scriptname\.lsl

View file

@ -0,0 +1 @@
ProgName -O help

View file

@ -0,0 +1,9 @@
// Test inclusion of headers and invalidation of comments
/*
blah
/|*
/||*
*/
default{timer(){}}

View file

@ -0,0 +1,24 @@
REGEX
//start_unprocessed_text
/\*// Test inclusion of headers and invalidation of comments
/\*
blah
/\|\|\*
/\|\|\|\*
\*\|/
default\{timer\(\)\{\}\}
\*/
//end_unprocessed_text
//nfo_preprocessor_version 0
//program_version LSL PyOptimizer .* - Sei Lisa
//mono
// Generated on 20.*Z
default
\{
timer\(\)
\{
\}
\}

View file

@ -0,0 +1 @@
main.py -T -H --avname=Sei\ Lisa --shortname=script.lsl -

View file

@ -0,0 +1,49 @@
f1() inline
{
llOwnerSay("f1");
}
f2(integer f2param) inline
{
llOwnerSay("f2:" + (string)f2param);
}
vector f3(integer f3p1, string f3p2) inline
{
f2(f3p1);
integer f3p1; // test shading the parameter
{
jump x;
llOwnerSay("f3:" + (string)f3p1 + f3p2);
}
@x;
if (f3p2 != "") return <1,1,1>;
do ; while (f4());
return <0,0,0>;
}
integer f4() inline
{
return llGetLinkNumber();
}
say(string s) inline
{
llOwnerSay(s);
}
default
{
state_entry()
{
f1();
if (1) f1();
f2(3);
if (f3(4, "x") == ZERO_VECTOR) llOwnerSay("ok");
}
timer()
{
say("hi");
}
}

View file

@ -0,0 +1,71 @@
default
{
state_entry()
{
{
llOwnerSay("f1");
}
if (1)
{
llOwnerSay("f1");
}
{
integer f2param = 3;
{
llOwnerSay("f2:" + (string)f2param);
}
}
vector ___ret__00001;
{
integer f3p1 = 4;
string f3p2 = "x";
{
{
integer f2param = f3p1;
{
llOwnerSay("f2:" + (string)f2param);
}
}
integer f3p1;
{
jump ___lbl__00005;
llOwnerSay("f3:" + (string)f3p1 + f3p2);
}
@___lbl__00005;
if (f3p2 != "")
{
___ret__00001 = <1, 1, 1>;
jump ___rtl__00004;
}
integer ___ret__00002;
{
{
___ret__00002 = llGetLinkNumber();
jump ___rtl__00007;
}
}
@___rtl__00007;
do
;
while (___ret__00002);
{
___ret__00001 = <0, 0, 0>;
jump ___rtl__00004;
}
}
}
@___rtl__00004;
if (___ret__00001 == <0., 0., 0.>)
llOwnerSay("ok");
}
timer()
{
{
string s = "hi";
{
llOwnerSay(s);
}
}
}
}

View file

@ -0,0 +1 @@
main.py -y -O clear,inline -

View file

@ -0,0 +1 @@
EExpansionLoop: Loop found in expansion of inline functions

View file

@ -0,0 +1,19 @@
f1() inline
{
llOwnerSay("f1");
f2();
}
f2() inline
{
llOwnerSay("f2");
f1();
}
default
{
state_entry()
{
f1();
}
}

View file

@ -0,0 +1 @@
main.py -O clear,inline -

View file

@ -0,0 +1,11 @@
// Test inline, by Sei Lisa
say(string s) inline
{
llOwnerSay(s);
}
default{timer(){
say("hey");
}}

View file

@ -0,0 +1,11 @@
default
{
timer()
{
{
{
llOwnerSay("hey");
}
}
}
}

View file

@ -0,0 +1,49 @@
f1() inline
{
llOwnerSay("f1");
}
f2(integer f2param) inline
{
llOwnerSay("f2:" + (string)f2param);
}
vector f3(integer f3p1, string f3p2) inline
{
f2(f3p1);
integer f3p1; // test shading the parameter
{
jump x;
llOwnerSay("f3:" + (string)f3p1 + f3p2);
}
@x;
if (f3p2 != "") return <1,1,1>;
do ; while (f4());
return <0,0,0>;
}
integer f4() inline
{
return llGetLinkNumber();
}
say(string s) inline
{
llOwnerSay(s);
}
default
{
state_entry()
{
f1();
if (1) f1();
f2(3);
if (f3(4, "x") == ZERO_VECTOR) llOwnerSay("ok");
}
timer()
{
say("hi");
}
}

View file

@ -0,0 +1,62 @@
default
{
state_entry()
{
{
llOwnerSay("f1");
}
{
llOwnerSay("f1");
}
{
{
llOwnerSay("f2:" + "3");
}
}
vector ___ret__00001 = <((float)0), ((float)0), ((float)0)>;
{
{
{
{
llOwnerSay("f2:" + "4");
}
}
{
jump ___lbl__00005;
}
@___lbl__00005;
{
___ret__00001 = <((float)1), ((float)1), ((float)1)>;
jump ___rtl__00004;
}
integer ___ret__00002;
{
{
___ret__00002 = llGetLinkNumber();
jump ___rtl__00007;
}
}
@___rtl__00007;
do
;
while (___ret__00002);
{
___ret__00001 = <((float)0), ((float)0), ((float)0)>;
jump ___rtl__00004;
}
}
}
@___rtl__00004;
if (___ret__00001 == <((float)0), ((float)0), ((float)0)>)
llOwnerSay("ok");
}
timer()
{
{
{
llOwnerSay("hi");
}
}
}
}

View file

@ -0,0 +1,2 @@
REGEX
IOError: (?:\[Errno 21\] Is a directory|\[Errno 13\] Permission denied): 'unit_tests/coverage.suite/actually-a-dir.d'

View file

@ -0,0 +1 @@
main.py unit_tests/coverage.suite/actually-a-dir.d

View file

@ -0,0 +1,3 @@
REGEX
Error: option --invalid-option not recognized

View file

@ -0,0 +1 @@
main.py --invalid-option

View file

@ -0,0 +1,3 @@
default{timer(){x;}}
^
(Line 10 char 17): ERROR in "somefile.lsl": Name not defined within scope

View file

@ -0,0 +1,4 @@
#line 1 "<stdin>"
#line 1 "somefile.lsl"
#line 10
default{timer(){x;}}

View file

@ -0,0 +1 @@
main.py -O processpre -

View file

@ -0,0 +1,9 @@
// Cover optimizer.Cast() using a call in lsldeadcode.
default{timer(){
vector v;
float f = llGetNumberOfSides() + v.x = 3;
llOwnerSay((string)[f]);
}}

View file

@ -0,0 +1,8 @@
default
{
timer()
{
float f = ((float)3) + llGetNumberOfSides();
llOwnerSay((string)((list)f));
}
}

View file

@ -0,0 +1 @@
main.py -

View file

@ -0,0 +1,2 @@
WARNING: Illegal combo: Key type inside a global list
WARNING: A string contains a tab. Tabs are expanded to four spaces by the viewer when copy-pasting the code (disable this warning by disabling the 'warntabs' option).

View file

@ -0,0 +1,37 @@
list L = [llList2Key([llUnescapeURL("%09")], 0)];
float f1 = -0.; // kept the same
float f2 = -3.; // transformed to -3
default
{
state_entry()
{
float f0 = -15.5; // transformed to (float)-15.5
vector v = <f0, f1, f2>;
rotation r = <f0, f1, f2, f0>;
integer i;
while (llFrand(2) > 1)
{
llOwnerSay((string)(f0 + f1 + f2 + i));
llSetPrimitiveParams(L);
llSetPrimitiveParams(L);
L = llGetPhysicsMaterial();
f0 = llList2Float(L, 0);
f1 = llList2Float(L, 1);
f2 = llList2Float(L, 2);
i = llList2Integer(L, i++);
i = llList2Integer(L, i--);
v = <f1, 0, 0>;
r = <f1, 0, 0, 0>f1>;
llSetRegionPos(v);
llSetLocalRot(r);
print(r.s);
++i; --i;
if (i)
i >>= 1;
else if (i > llFrand(3))
return;
L[2] = (integer)L[3];
}
}
}

View file

@ -0,0 +1,45 @@
list lazy_list_set(list L, integer i, list v)
{
while ((L != []) < i)
L = L + 0;
return llListReplaceList(L, v, i, i);
}
list L = [(key)" "];
float f1 = -0.;
float f2 = -3;
default
{
state_entry()
{
float f0 = ((float)-15.5);
vector v = <f0, f1, f2>;
rotation r = <f0, f1, f2, f0>;
integer i;
while (1 < llFrand(2))
{
llOwnerSay((string)(f0 + f1 + f2 + i));
llSetPrimitiveParams(L);
llSetPrimitiveParams(L);
L = llGetPhysicsMaterial();
f0 = llList2Float(L, 0);
f1 = llList2Float(L, 1);
f2 = llList2Float(L, 2);
i = llList2Integer(L, i++);
i = llList2Integer(L, i--);
v = <f1, 0, 0>;
r = <f1, 0, 0, (f1 < 0)>;
llSetRegionPos(v);
llSetLocalRot(r);
print(r.s);
++i;
--i;
if (i)
i = i >> 1;
else if (llFrand(3) < i)
return;
L = lazy_list_set(L, 2, (list)llList2Integer(L, 3));
}
}
}

View file

@ -0,0 +1 @@
main.py -O foldtabs,lazylists -

View file

@ -0,0 +1,8 @@
default
{
state_entry()
{
list L = llGetPhysicsMaterial();
for(L[1];llFrand(2)<1;);
}
}

View file

@ -0,0 +1,9 @@
default
{
state_entry()
{
list L = llGetPhysicsMaterial();
for ((MISSING TYPE)L[1]; llFrand(2) < 1; )
;
}
}

View file

@ -0,0 +1 @@
main.py -O -dcr,-constfold,lazylists -

View file

@ -0,0 +1 @@
This generates a runtime error now

View file

@ -0,0 +1,56 @@
// Coverage tests of normal parsing
f(){f();} // triggers FindSymbolPartial's last lines except the very last
integer g(){if(1)return 1;else return 1;}
integer T = TRUE;
vector V = <1,-2,TRUE>;
quaternion Q = <PI, 1.0, 0, 1>;
list L = [];
default
{
timer()
{
integer i;
float f;
vector v;
// Parse_vector_rotation_tail
<0,0,0.1>1>;
// Parse_unary_postfix_expression
ZERO_VECTOR;
i = 1;
i += i;
f += i;
i -= 1;
i *= f;
i /= 1;
i %= 1;
v *= i;
++v.x;
// Parse_bitxor
2^2;
// Parse_expression
1&&1;
// Parse_statement
@J;
1;
jump J;
// Scanner coverage
quaternion q;
1.3f;
0x0;
0x00000100000000;
4294967296;
42949672950;
L"\t\"";
1 // Not a string delimiter because it has \ at EOL:
" \
// Not a string delimiter because it's the last double quote
// in the file:
";
}
}

View file

@ -0,0 +1,51 @@
f()
{
f();
}
integer g()
{
if (1)
return 1;
else
return 1;
}
integer T = 1;
vector V = <1, -2, 1>;
rotation Q = <3.1415927, 1., 0, 1>;
list L = [];
default
{
timer()
{
integer i;
float f;
vector v;
<0, 0, (0.1 > 1)>;
<0., 0., 0.>;
i = 1;
i += i;
f += i;
i -= 1;
i *= f;
i /= 1;
i %= 1;
v *= i;
++v.x;
2 ^ 2;
1 && 1;
@J;
1;
jump J;
rotation q;
1.3;
0;
-1;
-1;
-1;
"\" \"";
1;
}
}

View file

@ -0,0 +1 @@
main.py -y -O clear -

View file

@ -0,0 +1,57 @@
// Test the extra features of the parser, to complete coverage.
string S = "a" "b"; // juxtaposition in globals
f(){}
integer f(){return 1;}
default
{
timer()
{
// String juxtaposition coverage
"a" "b";
// Explicit cast and extended cast coverage
integer i;
float f;
list L;
f += i;
L += (integer)(float)i;
i = ~(integer)-2*3;
i = ~(integer)-2.*3;
i = ~(integer)-i*3;
// AllowKeyConcat coverage
""+(key)"";
(key)""+"";
// Parse_statement with duplicate labels.
@J;
// does_something() coverage
switch(1)
{
{1;}
}
// loops, switch and break/continue
while (1) {break;for (;2;) {continue;break;} continue;}
do { continue; break 1; } while (1);
jump x;
while (1) @x;
jump y;
for (;1;) @y;
jump z;
do @z; while (0);
switch(1.0)
{
case 1: {1;}
}
switch(1)
{
default {}
}
while (1) continue;
while (1) while (1) while (1) continue 3;
}
}

View file

@ -0,0 +1,93 @@
string S = "ab";
integer f()
{
return 1;
}
default
{
timer()
{
"ab";
integer i;
float f;
list L;
f += (float)i;
L += (list)((integer)((float)i));
i = (~(integer)-2) * 3;
i = (~(integer)-2.) * 3;
i = (~(integer)(-i)) * 3;
"" + (string)((key)"");
(string)((key)"") + "";
@J;
{
jump J_autoGen00001;
{
1;
}
@J_autoGen00001;
}
{
while (1)
{
jump J_autoGen00002;
{
for (; 2; )
{
jump J_autoGen00005;
jump J_autoGen00004;
@J_autoGen00005;
}
@J_autoGen00004;
}
jump J_autoGen00003;
@J_autoGen00003;
}
@J_autoGen00002;
}
{
do
{
jump J_autoGen00007;
jump J_autoGen00006;
@J_autoGen00007;
}
while (1);
@J_autoGen00006;
}
jump x;
while (1)
@x;
jump y;
for (; 1; )
@y;
jump z;
do
@z;
while (0);
{
if (1. == (float)1)
jump J_autoGen00015;
jump J_autoGen00014;
@J_autoGen00015;
{
1;
}
@J_autoGen00014;
}
{
{
}
}
while (1)
;
while (1)
{
while (1)
while (1)
jump J_autoGen00022;
@J_autoGen00022;
}
}
}

View file

@ -0,0 +1 @@
main.py -O clear,allowmultistrings,enableswitch,explicitcast,extendedassignment,extendedtypecast,allowkeyconcat,duplabels,processpre,breakcont,funcoverride -

View file

@ -0,0 +1,3 @@
default{ev(){
list L = LIST_CONSTANT;
}}

View file

@ -0,0 +1,7 @@
default
{
ev()
{
list L = [];
}
}

View file

@ -0,0 +1 @@
main.py -b unit_tests/builtins-coverage-1.txt -L unit_tests/fndata-coverage-3.txt -O -dcr -

View file

@ -0,0 +1,25 @@
WARNING: Key constants not supported in unit_tests/builtins-coverage-4.txt, line 1: const key a="\t"
WARNING: Event at line 3 was already defined in unit_tests/builtins-coverage-4.txt, overwriting: ev
WARNING: Function at line 5 was already defined in unit_tests/builtins-coverage-4.txt, overwriting: x
WARNING: Invalid type in unit_tests/builtins-coverage-4.txt, line 6: blah
WARNING: Invalid type in unit_tests/builtins-coverage-4.txt, line 7: unknown
WARNING: Syntax error in unit_tests/builtins-coverage-4.txt, line 8
WARNING: Invalid vector/rotation syntax in unit_tests/builtins-coverage-4.txt line 9: const vector a = <4,5,3,2>
WARNING: Global at line 10 was already defined in unit_tests/builtins-coverage-4.txt, overwriting: a
WARNING: Invalid vector/rotation syntax in unit_tests/builtins-coverage-4.txt line 10: const vector a = <4,5,3,2
WARNING: Global at line 11 was already defined in unit_tests/builtins-coverage-4.txt, overwriting: a
WARNING: Invalid vector/rotation syntax in unit_tests/builtins-coverage-4.txt line 11: const vector a = <x,4,3>
WARNING: Global at line 12 was already defined in unit_tests/builtins-coverage-4.txt, overwriting: a
WARNING: Invalid vector/rotation syntax in unit_tests/builtins-coverage-4.txt line 12: const vector a = <4,x,3>
WARNING: Global at line 13 was already defined in unit_tests/builtins-coverage-4.txt, overwriting: a
WARNING: Invalid vector/rotation syntax in unit_tests/builtins-coverage-4.txt line 13: const vector a = <3,4,x>
WARNING: Global at line 14 was already defined in unit_tests/builtins-coverage-4.txt, overwriting: a
WARNING: Invalid vector/rotation syntax in unit_tests/builtins-coverage-4.txt line 14: const rotation a = <3,4,4,x>
WARNING: Invalid string in unit_tests/builtins-coverage-4.txt line 17: const string v="
WARNING: Global at line 18 was already defined in unit_tests/builtins-coverage-4.txt, overwriting: q
WARNING: Invalid type in unit_tests/builtins-coverage-4.txt, line 19: unknown
WARNING: Non-empty list constants not supported in unit_tests/builtins-coverage-4.txt, line 20: const list L = [1]
WARNING: Invalid list value in unit_tests/builtins-coverage-4.txt, line 21: const list L2 = [
^
(Line 1 char 1): ERROR: Unexpected EOF

View file

View file

@ -0,0 +1 @@
main.py -b unit_tests/builtins-coverage-4.txt -L unit_tests/fndata-coverage-4.txt -O -dcr,-processpre -

View file

@ -0,0 +1,3 @@
integer a;
^
(Line 2 char 10): ERROR: Name previously declared within scope

View file

@ -0,0 +1,2 @@
integer a;
integer a;

View file

@ -0,0 +1 @@
main.py -O clear - -y

View file

@ -0,0 +1,3 @@
default: ;
^
(Line 2 char 5): ERROR: 'default' used outside a 'switch' statement

View file

@ -0,0 +1,3 @@
x(){
default: ;
}

View file

@ -0,0 +1 @@
main.py -O clear,enableswitch -

View file

@ -0,0 +1,3 @@
case 1: ;
^
(Line 3 char 3): ERROR: 'case' used outside a 'switch' statement

View file

@ -0,0 +1,4 @@
x()
{
case 1: ;
}

View file

@ -0,0 +1 @@
main.py -O clear,enableswitch -

View file

@ -0,0 +1,3 @@
{case 1: ;}
^
(Line 5 char 10): ERROR: 'case' label only allowed at the main 'switch' block

View file

@ -0,0 +1,7 @@
x()
{
switch(1)
{
{case 1: ;}
}
}

View file

@ -0,0 +1 @@
main.py -O clear,enableswitch -

View file

@ -0,0 +1,3 @@
{default:;}
^
(Line 5 char 10): ERROR: 'default' label only allowed at the main 'switch' block

View file

@ -0,0 +1,7 @@
x()
{
switch(1)
{
{default:;}
}
}

View file

@ -0,0 +1 @@
main.py -O clear,enableswitch -

View file

@ -0,0 +1,3 @@
}
^
(Line 8 char 1): ERROR: multiple 'default' labels inside 'switch' statement

View file

@ -0,0 +1,8 @@
x()
{
switch(1)
{
default: ;;
default: ;;
}
}

View file

@ -0,0 +1 @@
main.py -O clear,enableswitch -

View file

@ -0,0 +1,3 @@
}
^
(Line 7 char 1): ERROR: Missing 'default:' label inside 'switch' statement; disable option 'errmissingdefault' to disable this error.

View file

@ -0,0 +1,7 @@
x()
{
switch(1)
{
case 1: ;;
}
}

View file

@ -0,0 +1 @@
main.py -O clear,enableswitch,errmissingdefault -

View file

@ -0,0 +1,3 @@
break;
^
(Line 3 char 5): ERROR: 'break' used outside a switch

View file

@ -0,0 +1,4 @@
x()
{
break;
}

View file

@ -0,0 +1 @@
main.py -O clear,enableswitch -

View file

@ -0,0 +1,3 @@
break;
^
(Line 3 char 5): ERROR: 'break' used outside a loop

View file

@ -0,0 +1,4 @@
x()
{
break;
}

View file

@ -0,0 +1 @@
main.py -O clear,breakcont -

View file

@ -0,0 +1,3 @@
continue;
^
(Line 3 char 5): ERROR: 'continue' used outside a loop

View file

@ -0,0 +1,4 @@
x()
{
continue;
}

View file

@ -0,0 +1 @@
main.py -O clear,breakcont -

View file

@ -0,0 +1,3 @@
#define a \
^
(Line 1 char 1): ERROR: Preprocessor directive can't end in backslash. Activate the preprocessor or put everything in the same line.

View file

@ -0,0 +1,3 @@
#define a \
x(){}

View file

@ -0,0 +1 @@
main.py -O clear,processpre -

View file

@ -0,0 +1,3 @@
return 0;
^
(Line 2 char 8): ERROR: Return statement type doesn't match function return type

View file

@ -0,0 +1,3 @@
x(){
return 0;
}

Some files were not shown because too many files have changed in this diff Show more