Skip to content

Commit b2e6308

Browse files
Add regression tests for initialization of Java main args
1 parent 11b1acd commit b2e6308

File tree

47 files changed

+293
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

47 files changed

+293
-0
lines changed
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
public class Main
2+
{
3+
public static void main(String[] args)
4+
{
5+
if(args.length>0)
6+
assert(args[0] != null); // must hold
7+
}
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
Main.class
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
public class Main
2+
{
3+
public static void main(String[] args)
4+
{
5+
if(args.length>0) {
6+
assert(args[0] != null); // must not fail
7+
}
8+
}
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
Main.class
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public class Main
2+
{
3+
public static void main(String[] args)
4+
{
5+
assert(args != null); // must hold
6+
}
7+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
Main.class
3+
--function Main.main
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring
518 Bytes
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public class Main
2+
{
3+
public static void main(String[] args)
4+
{
5+
assert(args != null); // must hold
6+
}
7+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
Main.class
3+
4+
^EXIT=0$
5+
^SIGNAL=0$
6+
^VERIFICATION SUCCESSFUL$
7+
--
8+
^warning: ignoring
Binary file not shown.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
public class Main
2+
{
3+
static void main(String[] args) // not public!
4+
{
5+
if(args != null && args.length>0)
6+
assert(args[0] != null); // allowed to fail
7+
}
8+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
Main.class
3+
--function Main.main
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
--
8+
^warning: ignoring
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
public class Main
2+
{
3+
static void main(String[] args) // not public!
4+
{
5+
if(args != null && args.length>0) {
6+
assert(args[0] == null); // allowed to fail
7+
}
8+
}
9+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
Main.class
3+
--function Main.main
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
--
8+
^warning: ignoring
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public class Main
2+
{
3+
public void main(String[] args) // not static!
4+
{
5+
assert(args != null); // allowed to fail
6+
}
7+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
Main.class
3+
--function Main.main
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
--
8+
^warning: ignoring
Binary file not shown.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
public class Main
2+
{
3+
public void main(String[] args) // not static!
4+
{
5+
assert(args == null); // allowed to fail
6+
}
7+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
CORE
2+
Main.class
3+
--function Main.main
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
--
8+
^warning: ignoring
Binary file not shown.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
public class Main
2+
{
3+
public static void main(int[] args)
4+
{
5+
assert(args == null); // allowed to fail
6+
assert(args != null); // allowed to fail
7+
if(args != null && args.length > 0) {
8+
try {
9+
int i = args[0];
10+
}
11+
catch(Exception e) {
12+
assert false; // must hold
13+
}
14+
}
15+
}
16+
}
17+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
CORE
2+
Main.class
3+
--function Main.main --java-throw-runtime-exceptions
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
assertion at file Main\.java line 5 function .* bytecode-index 6: FAILURE
8+
assertion at file Main\.java line 6 function .* bytecode-index 14: FAILURE
9+
assertion at file Main\.java line 12 function .* bytecode-index 31: SUCCESS
10+
\*\* 2 of .* failed
11+
--
12+
^warning: ignoring
Binary file not shown.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class Main
2+
{
3+
public static void main(String[][] args)
4+
{
5+
assert(args == null ||
6+
args.length == 0 ||
7+
args[0] == null ||
8+
args[0].length == 0 ||
9+
args[0][0] != null); // allowed to fail
10+
}
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
Main.class
3+
--function Main.main
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
assertion at file Main\.java line 5 function .* bytecode-index 24: FAILURE
8+
\*\* 1 of .* failed
9+
--
10+
^warning: ignoring
Binary file not shown.
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
public class Main
2+
{
3+
public static void main(String[][] args)
4+
{
5+
assert(args == null ||
6+
args.length == 0 ||
7+
args[0] == null ||
8+
args[0].length == 0 ||
9+
args[0][0] == null); // allowed to fail
10+
}
11+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
Main.class
3+
--function Main.main
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
assertion at file Main\.java line 5 function .* bytecode-index 24: FAILURE
8+
\*\* 1 of .* failed
9+
--
10+
^warning: ignoring
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
public class Main
2+
{
3+
public static void main(Main[] args)
4+
{
5+
if(args != null && args.length > 0) {
6+
assert(args[0] == null); // allowed to fail
7+
}
8+
}
9+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
Main.class
3+
--function Main.main
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
assertion at file Main\.java line 12 function .* bytecode-index 15: FAILURE
8+
\*\* 1 of .* failed
9+
--
10+
^warning: ignoring
Binary file not shown.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
public class Main
2+
{
3+
public static void main(Main[] args)
4+
{
5+
if(args != null && args.length > 0) {
6+
assert(args[0] != null); // allowed to fail
7+
}
8+
}
9+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
CORE
2+
Main.class
3+
--function Main.main
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
assertion at file Main\.java line 12 function .* bytecode-index 15: FAILURE
8+
\*\* 1 of .* failed
9+
--
10+
^warning: ignoring
Binary file not shown.
Binary file not shown.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
public class Main
2+
{
3+
public static class A {
4+
int x;
5+
}
6+
public A a;
7+
8+
public static void main(Main[] args)
9+
{
10+
assert(args != null); // allowed to fail
11+
if(args != null && args.length > 0) {
12+
Main m = args[0];
13+
if(m != null) {
14+
assert(m.a == null); // allowed to fail
15+
}
16+
}
17+
}
18+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
Main.class
3+
--function Main.main
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
assertion at file Main\.java line 10 function .* bytecode-index 6: FAILURE
8+
assertion at file Main\.java line 14 function .* bytecode-index 26: FAILURE
9+
\*\* 2 of .* failed
10+
--
11+
^warning: ignoring
Binary file not shown.
Binary file not shown.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
public class Main
2+
{
3+
public static class A {
4+
int x;
5+
}
6+
public A a;
7+
8+
public static void main(Main[] args)
9+
{
10+
assert(args != null); // allowed to fail
11+
if(args != null && args.length > 0) {
12+
Main m = args[0];
13+
if(m != null) {
14+
assert(m.a != null); // allowed to fail
15+
}
16+
}
17+
}
18+
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
CORE
2+
Main.class
3+
--function Main.main
4+
^EXIT=10$
5+
^SIGNAL=0$
6+
^VERIFICATION FAILED$
7+
assertion at file Main\.java line 10 function .* bytecode-index 6: FAILURE
8+
assertion at file Main\.java line 14 function .* bytecode-index 26: FAILURE
9+
\*\* 2 of .* failed
10+
--
11+
^warning: ignoring

0 commit comments

Comments
 (0)