45 private static final boolean VERBOSE = Boolean.valueOf(System.getProperty("parsertest.verbose"));
46 private static final boolean TEST262 = Boolean.valueOf(System.getProperty("parsertest.test262"));
47
48 private static final String TEST_BASIC_DIR = System.getProperty("test.basic.dir");
49 private static final String TEST262_SUITE_DIR = System.getProperty("test262.suite.dir");
50
51
52 interface TestFilter {
53 public boolean exclude(File file, String content);
54 }
55
56 private static void log(final String msg) {
57 org.testng.Reporter.log(msg, true);
58 }
59
60 private Context context;
61
62 @BeforeClass
63 public void setupTest() {
64 final Options options = new Options("nashorn");
65 options.set("anon.functions", true);
66 options.set("parse.only", true);
67 options.set("scripting", true);
68 options.set("const.as.var", true);
69
70 final ErrorManager errors = new ErrorManager();
71 this.context = new Context(options, errors, Thread.currentThread().getContextClassLoader());
72 }
73
74 @AfterClass
75 public void tearDownTest() {
76 this.context = null;
77 }
78
79 @Test
80 public void parseAllTests() {
81 if (TEST262) {
82 parseTestSet(TEST262_SUITE_DIR, new TestFilter() {
83 @Override
84 public boolean exclude(final File file, final String content) {
85 return content != null && content.contains("@negative");
|
45 private static final boolean VERBOSE = Boolean.valueOf(System.getProperty("parsertest.verbose"));
46 private static final boolean TEST262 = Boolean.valueOf(System.getProperty("parsertest.test262"));
47
48 private static final String TEST_BASIC_DIR = System.getProperty("test.basic.dir");
49 private static final String TEST262_SUITE_DIR = System.getProperty("test262.suite.dir");
50
51
52 interface TestFilter {
53 public boolean exclude(File file, String content);
54 }
55
56 private static void log(final String msg) {
57 org.testng.Reporter.log(msg, true);
58 }
59
60 private Context context;
61
62 @BeforeClass
63 public void setupTest() {
64 final Options options = new Options("nashorn");
65 options.set("parse.only", true);
66 options.set("scripting", true);
67 options.set("const.as.var", true);
68
69 final ErrorManager errors = new ErrorManager();
70 this.context = new Context(options, errors, Thread.currentThread().getContextClassLoader());
71 }
72
73 @AfterClass
74 public void tearDownTest() {
75 this.context = null;
76 }
77
78 @Test
79 public void parseAllTests() {
80 if (TEST262) {
81 parseTestSet(TEST262_SUITE_DIR, new TestFilter() {
82 @Override
83 public boolean exclude(final File file, final String content) {
84 return content != null && content.contains("@negative");
|