ide/editor/src/test/java/org/apidesign/bck2brwsr/ide/editor/DejsniReaderTest.java
2 * Back 2 Browser Bytecode Translator
3 * Copyright (C) 2012 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, version 2 of the License.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. Look for COPYING file in the top folder.
16 * If not, see http://opensource.org/licenses/GPL-2.0.
18 package org.apidesign.bck2brwsr.ide.editor;
20 import org.apidesign.bck2brwsr.core.JavaScriptBody;
21 import org.netbeans.modules.java.hints.test.api.HintTest;
22 import org.openide.filesystems.FileUtil;
23 import org.testng.annotations.Test;
25 public class DejsniReaderTest {
28 public void test1() throws Exception {
29 String s = "class Test {\n" +
31 " public native void test() /*-{\n" +
36 String expected = " import org.apidesign.bck2brwsr.core.JavaScriptBody;\n"
40 " @JavaScriptBody(args = {}, body = \"\\n // body\\n \")\n" +
41 " public native void test();\n" +
46 .classpath(FileUtil.getArchiveRoot(JavaScriptBody.class.getProtectionDomain().getCodeSource().getLocation()))
47 .run(JSNI2JavaScriptBody.class)
48 .findWarning("2:23-2:27:verifier:" + Bundle.ERR_JSNI2JavaScriptBody())
51 .assertOutput(expected);
56 public void test2() throws Exception {
57 String s = "class Test {\n" +
59 " @SuppressWarnings(\"unused\")\n" +
61 " public native void test() /*-{\n" +
66 String expected = " import org.apidesign.bck2brwsr.core.JavaScriptBody;\n"
70 " @SuppressWarnings(\"unused\")\n" +
72 " @JavaScriptBody(args = {}, body = \"\\n // body\\n \")\n" +
73 " public native void test();\n" +
77 .classpath(FileUtil.getArchiveRoot(JavaScriptBody.class.getProtectionDomain().getCodeSource().getLocation()))
78 .run(JSNI2JavaScriptBody.class)
79 .findWarning("4:23-4:27:verifier:" + Bundle.ERR_JSNI2JavaScriptBody())
82 .assertOutput(expected);