From 725b0100e2d29fe3a8e0392e32073d18d00e5fa5 Mon Sep 17 00:00:00 2001 From: Zalim Bashorov Date: Mon, 20 Mar 2017 21:10:39 +0300 Subject: [PATCH] KJS: remove useless StdLibTest --- .../kotlin/js/test/semantics/StdLibTest.java | 80 ------------------- .../stdlib/cases/browserDocumentAccess.kt | 13 --- 2 files changed, 93 deletions(-) delete mode 100644 js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/StdLibTest.java delete mode 100644 js/js.translator/testData/stdlib/cases/browserDocumentAccess.kt diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/StdLibTest.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/StdLibTest.java deleted file mode 100644 index 61627734c99..00000000000 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/StdLibTest.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright 2010-2015 JetBrains s.r.o. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package org.jetbrains.kotlin.js.test.semantics; - -import org.jetbrains.annotations.NotNull; -import org.jetbrains.kotlin.js.config.EcmaVersion; -import org.jetbrains.kotlin.js.facade.MainCallParameters; -import org.jetbrains.kotlin.js.test.SingleFileTranslationTest; -import org.jetbrains.kotlin.js.test.rhino.RhinoFunctionNativeObjectResultChecker; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; - -import javax.xml.parsers.DocumentBuilderFactory; -import java.util.Arrays; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -public final class StdLibTest extends SingleFileTranslationTest { - - public StdLibTest() { - super("stdlib/"); - } - - public void testBrowserDocumentAccessCompiles() throws Exception { - generateJavaScriptFiles("browserDocumentAccess.kt", MainCallParameters.noCall(), DEFAULT_ECMA_VERSIONS); - } - - @Override - protected void generateJavaScriptFiles(@NotNull String kotlinFilePath, - @NotNull MainCallParameters mainCallParameters, - @NotNull Iterable ecmaVersions) throws Exception { - List files = Arrays.asList(getInputFilePath(kotlinFilePath)); - - generateJavaScriptFiles(files, kotlinFilePath, mainCallParameters, ecmaVersions); - runRhinoTests(kotlinFilePath, ecmaVersions, - new RhinoFunctionNativeObjectResultChecker(TEST_MODULE, "test.browser", TEST_FUNCTION, "Some Dynamically Created Content!!!")); - } - - @Override - protected Map getRhinoTestVariables() throws Exception { - Document document = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument(); - Element root = document.createElement("root"); - //root.setIdAttribute("foo", true); - root.setAttribute("id", "foo"); - root.setIdAttribute("id", true); - document.appendChild(root); - - // lets test it actually works - Element foo = document.getElementById("foo"); - assertNotNull(foo); - - Map answer = new HashMap<>(); - answer.put("document", document); - answer.put("Node", new DummyNode()); - return answer; - } - - //class cannot be private because Rhino won't be able to access it then - @SuppressWarnings({"FieldMayBeStatic", "UnusedDeclaration"}) - public static class DummyNode { - public final short ELEMENT_NODE = Node.ELEMENT_NODE; - public final short TEXT_NODE = Node.TEXT_NODE; - } -} diff --git a/js/js.translator/testData/stdlib/cases/browserDocumentAccess.kt b/js/js.translator/testData/stdlib/cases/browserDocumentAccess.kt deleted file mode 100644 index 084a92cb791..00000000000 --- a/js/js.translator/testData/stdlib/cases/browserDocumentAccess.kt +++ /dev/null @@ -1,13 +0,0 @@ -package test.browser - -import kotlin.browser.document -import org.w3c.dom.Node - -fun box(): String { - val element = document.getElementById("foo")!! - val textNode = document.createTextNode("Some Dynamically Created Content!!!") - element.appendChild(textNode) - if (textNode.nodeType != Node.TEXT_NODE) return "The type of the node is ${textNode.nodeType}, ${Node.TEXT_NODE} was expected" - if (element.nodeType != Node.ELEMENT_NODE) return "The type of the node is ${element.nodeType}, ${Node.ELEMENT_NODE} was expected" - return element.textContent!! -}