Commit c0d0d441 authored by uwdkn's avatar uwdkn

Merge branch 'group1-syntax-testcases' into 'master'

Add syntax testcases from group 1

See merge request IPDSnelting/mjtest-tests!19
parents 1e49b316 73bf536d
/* Complete example using all productions */
class AllProductions {
public int field;
public boolean method(int a, String b) throws UsefulException {
return b;
}
public static void main(String[] args) throws SomeException {
;
if (true);else;
while(false);
1==1;
{
test[12] = 12;
true || true;
false && false;
a == b != c;
a < b <= c > d >= e;
a + b - c;
a * b / c % d;
-a;
!b;
foo.bar(2, true);
int b = foo.a;
null;
123;
test;
test();
this;
(1 + 2);
Test t = new Test();
int[][] c = new int[12][];
}
}
}
/* Syntactial correct expressions using the array syntax. */
class ArrayMadness {
public void[][][][][][][][][][][] voidArray;
public voidArray[] voidArrayArray;
public void method() {
voidArray = new voidArray[new voidArray[new voidArray[0][]]][][][][][][][];
voidArray[voidArray[voidArray[0]]];
}
}
class IncompleteClass {
public static void main(String[] args) {
int foo = System.in.read();
System.out.println(foo + 25 / 30);
}
public void Test;
/* missing } */
class MissingSemicolons {
public void FOO () {
;
if (a[a] == b) true
else false
;
}
}
/* Contains classes with multiple MainMethod */
class MultipleMainMethods {
public static void main(String[] args) {
}
public static void test(String[] test) {
}
public static void foo(String[] bar) {
}
}
class MoreMainMethods {
public static void main(String[] args) {
}
public static void test(String[] test) {
}
public static void foo(String[] bar) {
}
}
/* Deeply nested blocks */
class DeeplyNestedBlocks {
public static void main(String[] args) {
{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{{
System.out.println(42);
}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}}
}
}
class Outer {
class Inner {
}
}
class NestedMethods {
public void foo() {
public String bar() {
return new String();
}
}
}
/* Use _ as IDENT a lot */
class _ {
public _ _;
public static void _ (String[] _) {
}
public _ _ (_ _, _ _) {
;
_;
_ _;
if (_) _; else _;
while (_) _; _._;
_._(_[_], _);
(_);
!_||_&&_<_>_+_-_;
}
}
/* The grammar only allows String[] as parameter type for the main method. */
class WrongMainParameter {
public static void main(int[] args) {
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment