mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Moar tests
This commit is contained in:
@@ -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" });
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
println("Here comes an unterminated comment!")
|
||||
|
||||
/*
|
||||
banana
|
||||
apple
|
||||
pear
|
||||
* /
|
||||
|
||||
println("Do you see what I did there?")
|
||||
@@ -0,0 +1,5 @@
|
||||
int a;
|
||||
void setup()
|
||||
{
|
||||
a = #FF000;
|
||||
}
|
||||
@@ -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" });
|
||||
}
|
||||
}
|
||||
@@ -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");
|
||||
|
||||
Reference in New Issue
Block a user