Moar tests

This commit is contained in:
jdf
2010-03-18 01:55:44 +00:00
parent d6bd880d5a
commit 6bb52a9491
7 changed files with 135 additions and 4 deletions
+36
View File
@@ -0,0 +1,36 @@
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 bug136 extends PApplet {
java.util.List alist = Collections.synchronizedList(new ArrayList());
public void setup() {
size(400, 200);
alist.add("hello");
}
public void draw() {
rect(width/4, height/4, width/2, height/2);
synchronized(alist) {
alist.get(0);
}
}
static public void main(String args[]) {
PApplet.main(new String[] { "--bgcolor=null", "bug136" });
}
}
+13
View File
@@ -0,0 +1,13 @@
java.util.List alist = Collections.synchronizedList(new ArrayList());
void setup() {
size(400, 200);
alist.add("hello");
}
void draw() {
rect(width/4, height/4, width/2, height/2);
synchronized(alist) {
alist.get(0);
}
}
+9
View File
@@ -0,0 +1,9 @@
println("Here comes an unterminated comment!")
/*
banana
apple
pear
* /
println("Do you see what I did there?")
+5
View File
@@ -0,0 +1,5 @@
int a;
void setup()
{
a = #FF000;
}
+27
View File
@@ -0,0 +1,27 @@
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 bug4 extends PApplet {
public void setup() {
int x = 12;
float u = (PApplet.parseFloat(x)/width);
noLoop();
}
static public void main(String args[]) {
PApplet.main(new String[] { "--bgcolor=null", "bug4" });
}
}
+2
View File
@@ -0,0 +1,2 @@
int x = 12;
float u = (float(x)/width);
@@ -78,9 +78,27 @@ public class ParserTests {
assertEquals(expectedLine, e.getLine());
} catch (Exception e) {
if (!e.equals(e.getCause()) && e.getCause() != null)
fail(e.getCause().getMessage());
fail(e.getCause().toString());
else
fail(e.getMessage());
fail(e.toString());
}
}
static void expectRunnerException(final String id,
final String expectedMessage,
final int expectedLine) {
try {
preprocess(id, res(id + ".pde"));
fail("Expected to fail with \"" + expectedMessage + "\" on line "
+ expectedLine);
} catch (RunnerException e) {
assertEquals(expectedMessage, e.getMessage());
assertEquals(expectedLine, e.getCodeLine());
} catch (Exception e) {
if (!e.equals(e.getCause()) && e.getCause() != null)
fail(e.getCause().toString());
else
fail(e.toString());
}
}
@@ -108,12 +126,17 @@ public class ParserTests {
} catch (Exception e) {
if (!e.equals(e.getCause()) && e.getCause() != null)
fail(e.getCause().getMessage());
fail(e.getCause().toString());
else
fail(e.getMessage());
fail(e.toString());
}
}
@Test
public void bug4() {
expectGood("bug4");
}
@Test
public void bug5a() {
expectGood("bug5a");
@@ -124,6 +147,22 @@ public class ParserTests {
expectGood("bug5b");
}
@Test
public void bug16() {
expectRunnerException("bug16", "Unclosed /* comment */", 2);
}
@Test
public void bug136() {
expectGood("bug136");
}
@Test
public void bug196() {
expectRecognitionException("bug196",
"Web colors must be exactly 6 hex digits. This looks like 5.", 4);
}
@Test
public void bug1511() {
expectGood("bug1511");