Browse files

Fix tests.

Fix test package dirs.
  • Loading branch information...
1 parent bf75e01 commit 83d004c0833eaa7972440df2d33709326dbba7b7 @ycros committed Nov 17, 2011
View
2 ...groovy/org/monome/pages/ScriptBase.groovy → ...org/monome/pages/groovy/ScriptBase.groovy
@@ -1,4 +1,4 @@
-package org.monome.pages
+package org.monome.pages.groovy
import org.monome.pages.time.MusicalDuration
import org.monome.pages.time.MusicalScheduler
View
2 src/main/java/org/monome/pages/Main.java
@@ -6,8 +6,8 @@
import groovy.util.ResourceException;
import groovy.util.ScriptException;
import org.codehaus.groovy.control.CompilerConfiguration;
+import org.monome.pages.groovy.ScriptBase;
import org.monome.pages.time.MusicalLoop;
-import sun.org.mozilla.javascript.internal.Script;
import java.io.IOException;
View
7 src/main/java/org/monome/pages/time/MusicalScheduler.java
@@ -52,13 +52,14 @@ public long getTickNanoseconds() {
}
public void tick() {
- for (Task t : tasks) {
- t.tick();
- }
tasks.removeAll(tasksToDelete);
tasksToDelete.clear();
tasks.addAll(tasksToAdd);
tasksToAdd.clear();
+
+ for (Task t : tasks) {
+ t.tick();
+ }
}
public Task schedule(MusicalDuration every, Closure closure) {
View
0 ...ome.pages.time/MusicalDurationTest.groovy → ...ome/pages/time/MusicalDurationTest.groovy
File renamed without changes.
View
20 ...me.pages.time/MusicalSchedulerTest.groovy → ...me/pages/time/MusicalSchedulerTest.groovy
@@ -146,4 +146,24 @@ class MusicalSchedulerTest extends Specification {
a == 2
}
+ def "make sure we're protected against concurrent modifications"() {
+ def ms = new MusicalScheduler()
+ def a = 0
+ ms.setPpq(4)
+
+ def task = null
+ task = ms.schedule(new MusicalDuration(1, 4)) {
+ task.stop()
+ }
+
+ def task2 = null
+ task2 = ms.schedule(new MusicalDuration(1, 4)) {
+ task2.stop()
+ }
+
+ expect: "when we tick, no exception occurs"
+ ms.tick()
+ ms.tick()
+ }
+
}

0 comments on commit 83d004c

Please sign in to comment.