@@ -0,0 +1,2226 @@
+package jnode.jscript;%0A%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport javax.script.*;%0A%0A/**%0A * %D0%A2%D0%B5%D1%81%D1%82%D1%8B %D0%B4%D0%BB%D1%8F Jscript%0A * @author Manjago (kirill@temnenkov.com)%0A */%0Apublic class TestJscript %7B%0A%0A    private final static IJscriptHelper.Version version = new IJscriptHelper.Version() %7B%0A        @Override%0A        public int getMajor() %7B%0A            return 1;%0A        %7D%0A%0A        @Override%0A        public int getMinor() %7B%0A            return 0;%0A        %7D%0A    %7D;%0A    private ScriptEngine engine;%0A    private Bindings bindings;%0A    private TestHelper helper;%0A%0A    private static void evaluate(ScriptEngine engine, Bindings bindings) throws ScriptException %7B%0A        engine.eval(%22helper.writeFileToEchoarea(%5C%22testecho%5C%22,%5C%22testsubj%5C%22,%5C%22testfile%5C%22)%22, bindings);%0A    %7D%0A%0A    @Before%0A    public void init() %7B%0A        engine = new ScriptEngineManager()%0A                .getEngineByName(%22javascript%22);%0A        bindings = new SimpleBindings();%0A        helper = new TestHelper();%0A        bindings.put(JscriptExecutor.HELPER, helper);%0A    %7D%0A%0A    @Test%0A    public void testWriteFileToEchoarea() throws Exception %7B%0A        evaluate(engine, bindings);%0A        check();%0A    %7D%0A%0A    @Test(timeout = 1000L)%0A    public void testSpeed() throws Exception %7B%0A        for (int i = 0; i %3C 100; ++i) %7B%0A            evaluate(engine, bindings);%0A        %7D%0A        check();%0A%0A    %7D%0A%0A    private void check() %7B%0A        assert helper.getContent() != null &&%0A                helper.getContent().equals(%22testechotestsubjtestfile%22);%0A    %7D%0A%0A    @Test(expected = ScriptException.class)%0A    public void testFail() throws Exception %7B%0A        engine.eval(%22%D0%BF%D0%B0%D0%BB%D1%8F%D0%B1%D0%B0%22, bindings);%0A        assert false;%0A    %7D%0A%0A    class TestHelper implements IJscriptHelper %7B%0A%0A        private String content;%0A%0A        @Override%0A        public Version getVersion() %7B%0A            return version;%0A        %7D%0A%0A        @Override%0A        public void writeFileToEchoarea(String echoArea, String subject, String filename) %7B%0A            StringBuilder sb = new StringBuilder();%0A            sb.append(echoArea);%0A            sb.append(subject);%0A            sb.append(filename);%0A            content = sb.toString();%0A        %7D%0A%0A        public String getContent() %7B%0A            return content;%0A        %7D%0A%0A    %7D%0A%7D%0A

test for Jscript