test/src/jdk/nashorn/internal/codegen/CompilerTest.java

Print this page




  49     private static final boolean VERBOSE  = Boolean.valueOf(System.getProperty("compilertest.verbose"));
  50     private static final boolean TEST262  = Boolean.valueOf(System.getProperty("compilertest.test262"));
  51     private static final String TEST_BASIC_DIR  = System.getProperty("test.basic.dir");
  52     private static final String TEST_NODE_DIR  = System.getProperty("test.node.dir");
  53     private static final String TEST262_SUITE_DIR = System.getProperty("test262.suite.dir");
  54 
  55     interface TestFilter {
  56         public boolean exclude(File file, String content);
  57     }
  58 
  59     private static void log(final String msg) {
  60         org.testng.Reporter.log(msg, true);
  61     }
  62 
  63     private Context context;
  64     private Global  global;
  65 
  66     @BeforeClass
  67     public void setupTest() {
  68         final Options options = new Options("nashorn");
  69         options.set("anon.functions", true);
  70         options.set("compile.only", true);
  71         options.set("print.ast", true);
  72         options.set("print.parse", true);
  73         options.set("scripting", true);
  74         options.set("const.as.var", true);
  75         options.set("verify.code", true);
  76 
  77         final ErrorManager errors = new ErrorManager() {
  78             @Override
  79             public void error(final String msg) {
  80                 log(msg);
  81             }
  82         };
  83 
  84         final StringWriter sw = new StringWriter();
  85         final PrintWriter pw = new PrintWriter(sw);
  86         this.context = new Context(options, errors, pw, pw, Thread.currentThread().getContextClassLoader());
  87         this.global = context.createGlobal();
  88     }
  89 




  49     private static final boolean VERBOSE  = Boolean.valueOf(System.getProperty("compilertest.verbose"));
  50     private static final boolean TEST262  = Boolean.valueOf(System.getProperty("compilertest.test262"));
  51     private static final String TEST_BASIC_DIR  = System.getProperty("test.basic.dir");
  52     private static final String TEST_NODE_DIR  = System.getProperty("test.node.dir");
  53     private static final String TEST262_SUITE_DIR = System.getProperty("test262.suite.dir");
  54 
  55     interface TestFilter {
  56         public boolean exclude(File file, String content);
  57     }
  58 
  59     private static void log(final String msg) {
  60         org.testng.Reporter.log(msg, true);
  61     }
  62 
  63     private Context context;
  64     private Global  global;
  65 
  66     @BeforeClass
  67     public void setupTest() {
  68         final Options options = new Options("nashorn");

  69         options.set("compile.only", true);
  70         options.set("print.ast", true);
  71         options.set("print.parse", true);
  72         options.set("scripting", true);
  73         options.set("const.as.var", true);
  74         options.set("verify.code", true);
  75 
  76         final ErrorManager errors = new ErrorManager() {
  77             @Override
  78             public void error(final String msg) {
  79                 log(msg);
  80             }
  81         };
  82 
  83         final StringWriter sw = new StringWriter();
  84         final PrintWriter pw = new PrintWriter(sw);
  85         this.context = new Context(options, errors, pw, pw, Thread.currentThread().getContextClassLoader());
  86         this.global = context.createGlobal();
  87     }
  88