mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
More tests. Caught a regression!
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import processing.core.*;
|
||||
import processing.xml.*;
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.Image;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class bug1064 extends PApplet {
|
||||
public void setup() {
|
||||
// import ";
|
||||
noLoop();
|
||||
}
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "--bgcolor=null", "bug1064" });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
// import ";
|
||||
@@ -0,0 +1 @@
|
||||
import processing;
|
||||
@@ -0,0 +1,26 @@
|
||||
import processing.core.*;
|
||||
import processing.xml.*;
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.Image;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class bug1362 extends PApplet {
|
||||
public void setup() {
|
||||
if (true) {} else { new String(); }
|
||||
noLoop();
|
||||
}
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "--bgcolor=null", "bug1362" });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
if (true) {} else { new String(); }
|
||||
@@ -0,0 +1,26 @@
|
||||
import processing.core.*;
|
||||
import processing.xml.*;
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.Image;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class bug1442 extends PApplet {
|
||||
|
||||
public float a() {
|
||||
return 1.0f;
|
||||
}
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "--bgcolor=null", "bug1442" });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
float a() {
|
||||
return 1.0;
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
import processing.core.*;
|
||||
import processing.xml.*;
|
||||
|
||||
import static java.lang.Math.tanh;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import java.applet.*;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Frame;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.awt.event.FocusEvent;
|
||||
import java.awt.Image;
|
||||
import java.io.*;
|
||||
import java.net.*;
|
||||
import java.text.*;
|
||||
import java.util.*;
|
||||
import java.util.zip.*;
|
||||
import java.util.regex.*;
|
||||
|
||||
public class bug598 extends PApplet {
|
||||
|
||||
// java 5 torture test
|
||||
|
||||
|
||||
|
||||
|
||||
private static Comparator<String> rotarapmoc = new Comparator<String>() {
|
||||
public int compare(final String o1, final String o2)
|
||||
{
|
||||
return o1.charAt(o1.length() - 1) - o2.charAt(o2.length() - 1);
|
||||
}
|
||||
};
|
||||
|
||||
final <T> void printClass(T t) {
|
||||
println(t.getClass());
|
||||
}
|
||||
public final List<String> sortem(final String... strings) {
|
||||
Arrays.sort(strings, rotarapmoc);
|
||||
return Arrays.asList(strings);
|
||||
}
|
||||
|
||||
final Map<String, Collection<Integer>>
|
||||
charlesDeGaulle = new HashMap<String, Collection<Integer>>();
|
||||
|
||||
public void setup() {
|
||||
charlesDeGaulle.put("banana", new HashSet<Integer>());
|
||||
charlesDeGaulle.get("banana").add(0);
|
||||
System.out.println(sortem("aztec", "maya", "spanish", "portuguese"));
|
||||
printClass(12.d);
|
||||
}
|
||||
static public void main(String args[]) {
|
||||
PApplet.main(new String[] { "--bgcolor=null", "bug598" });
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
// java 5 torture test
|
||||
|
||||
import static java.lang.Math.tanh;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
private static Comparator<String> rotarapmoc = new Comparator<String>() {
|
||||
public int compare(final String o1, final String o2)
|
||||
{
|
||||
return o1.charAt(o1.length() - 1) - o2.charAt(o2.length() - 1);
|
||||
}
|
||||
};
|
||||
|
||||
final <T> void printClass(T t) {
|
||||
println(t.getClass());
|
||||
}
|
||||
final List<String> sortem(final String... strings) {
|
||||
Arrays.sort(strings, rotarapmoc);
|
||||
return Arrays.asList(strings);
|
||||
}
|
||||
|
||||
final Map<String, Collection<Integer>>
|
||||
charlesDeGaulle = new HashMap<String, Collection<Integer>>();
|
||||
|
||||
void setup() {
|
||||
charlesDeGaulle.put("banana", new HashSet<Integer>());
|
||||
charlesDeGaulle.get("banana").add(0);
|
||||
System.out.println(sortem("aztec", "maya", "spanish", "portuguese"));
|
||||
printClass(12.d);
|
||||
}
|
||||
@@ -115,7 +115,6 @@ public class ParserTests {
|
||||
+ expectedLine);
|
||||
}
|
||||
final String e = compilerResult.getStderr().split("\n")[0];
|
||||
System.err.println(e);
|
||||
final Matcher m = Pattern.compile(":(\\d+):\\s+(.+)$").matcher(e);
|
||||
m.find();
|
||||
assertEquals(expectedMessage, m.group(2));
|
||||
@@ -134,6 +133,8 @@ public class ParserTests {
|
||||
|
||||
final ProcessResult compilerResult = COMPILER.compile(id, program);
|
||||
if (!compilerResult.succeeded()) {
|
||||
System.err.println(program);
|
||||
System.err.println("----------------------------");
|
||||
System.err.println(compilerResult.getStderr());
|
||||
fail("Compilation failed with status " + compilerResult.getResult());
|
||||
}
|
||||
@@ -209,6 +210,11 @@ public class ParserTests {
|
||||
expectRecognitionException("bug507", "expecting EOF, found 'else'", 5);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bug598() {
|
||||
expectGood("bug598");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bug631() {
|
||||
expectGood("bug631");
|
||||
@@ -224,6 +230,26 @@ public class ParserTests {
|
||||
expectCompilerException("bug820", "x1 is already defined in setup()", 21);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bug1064() {
|
||||
expectGood("bug1064");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bug1145() {
|
||||
expectCompilerException("bug1145", "'.' expected", 4);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bug1362() {
|
||||
expectGood("bug1362");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bug1442() {
|
||||
expectGood("bug1442");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void bug1511() {
|
||||
expectGood("bug1511");
|
||||
|
||||
Reference in New Issue
Block a user