| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
package org.mozilla.javascript.tests; |
| 6 |
|
| 7 |
import java.io.File; |
| 8 |
import java.io.FileFilter; |
| 9 |
import java.io.IOException; |
| 10 |
|
| 11 |
import org.mozilla.javascript.drivers.TestUtils; |
| 12 |
import org.mozilla.javascript.drivers.JsTestsBase; |
| 13 |
|
| 14 |
public class JsTestsTest extends JsTestsBase { |
| 15 |
static final String baseDirectory = "testsrc" + File.separator + "jstests"; |
| 16 |
|
| 17 |
static final String jstestsExtension = ".jstest"; |
| 18 |
|
| 19 |
public void runJsTests() throws IOException { |
| 20 |
File[] tests = TestUtils.recursiveListFiles(new File(baseDirectory), |
| 21 |
new FileFilter() { |
| 22 |
public boolean accept(File f) { |
| 23 |
return f.getName().endsWith(jstestsExtension); |
| 24 |
} |
| 25 |
}); |
| 26 |
runJsTests(tests); |
| 27 |
} |
| 28 |
|
| 29 |
public void testJsTestsInterpreted() throws IOException { |
| 30 |
setOptimizationLevel(-1); |
| 31 |
runJsTests(); |
| 32 |
} |
| 33 |
|
| 34 |
public void testJsTestsCompiled() throws IOException { |
| 35 |
setOptimizationLevel(0); |
| 36 |
runJsTests(); |
| 37 |
} |
| 38 |
|
| 39 |
public void testJsTestsOptimized() throws IOException { |
| 40 |
setOptimizationLevel(9); |
| 41 |
runJsTests(); |
| 42 |
} |
| 43 |
} |