jaroslav@716: /** jaroslav@716: * Back 2 Browser Bytecode Translator jaroslav@716: * Copyright (C) 2012 Jaroslav Tulach jaroslav@716: * jaroslav@716: * This program is free software: you can redistribute it and/or modify jaroslav@716: * it under the terms of the GNU General Public License as published by jaroslav@716: * the Free Software Foundation, version 2 of the License. jaroslav@716: * jaroslav@716: * This program is distributed in the hope that it will be useful, jaroslav@716: * but WITHOUT ANY WARRANTY; without even the implied warranty of jaroslav@716: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the jaroslav@716: * GNU General Public License for more details. jaroslav@716: * jaroslav@716: * You should have received a copy of the GNU General Public License jaroslav@716: * along with this program. Look for COPYING file in the top folder. jaroslav@716: * If not, see http://opensource.org/licenses/GPL-2.0. jaroslav@716: */ jaroslav@716: package org.apidesign.bck2brwsr.ide.editor; jaroslav@716: jaroslav@716: import org.apidesign.bck2brwsr.core.JavaScriptBody; jaroslav@716: import org.netbeans.modules.java.hints.test.api.HintTest; jaroslav@716: import org.openide.filesystems.FileUtil; jaroslav@717: import org.testng.annotations.Test; jaroslav@716: jaroslav@716: public class JSNI2JavaScriptBodyTest { jaroslav@716: jaroslav@716: @Test jaroslav@716: public void testFixWorking() throws Exception { jaroslav@716: HintTest.create() jaroslav@716: .input("package test;\n" + jaroslav@716: "public class Test {\n" + jaroslav@716: " public native void run(int a) /*-{ this.a = a; }-*/;\n" + jaroslav@716: "}\n") jaroslav@716: .classpath(FileUtil.getArchiveRoot(JavaScriptBody.class.getProtectionDomain().getCodeSource().getLocation())) jaroslav@716: .run(JSNI2JavaScriptBody.class) jaroslav@716: .findWarning("2:23-2:26:verifier:" + Bundle.ERR_JSNI2JavaScriptBody()) jaroslav@716: .applyFix() jaroslav@716: .assertCompilable() jaroslav@716: .assertOutput("package test;\n" + jaroslav@716: "import org.apidesign.bck2brwsr.core.JavaScriptBody;\n" + jaroslav@716: "public class Test {\n" + jaroslav@722: " @JavaScriptBody(args = {\"a\"}, body = \" this.a = a; \")\n" + jaroslav@716: " public native void run(int a);\n" + jaroslav@716: "}\n"); jaroslav@716: } jaroslav@716: }