You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@netbeans.apache.org by jl...@apache.org on 2018/03/09 05:51:21 UTC

[incubator-netbeans] branch jdk18_3 updated: Fixing (var) completion tests on 8; allowing to run tests for features not supported by the current runtime platform.

This is an automated email from the ASF dual-hosted git repository.

jlahoda pushed a commit to branch jdk18_3
in repository https://gitbox.apache.org/repos/asf/incubator-netbeans.git


The following commit(s) were added to refs/heads/jdk18_3 by this push:
     new f71e150  Fixing (var) completion tests on 8; allowing to run tests for features not supported by the current runtime platform.
f71e150 is described below

commit f71e150ba448b80e37b48e529587ac93274963d6
Author: Jan Lahoda <jl...@netbeans.org>
AuthorDate: Fri Mar 9 06:50:28 2018 +0100

    Fixing (var) completion tests on 8; allowing to run tests for features not supported by the current runtime platform.
---
 java.completion/nbproject/project.xml              |   4 +
 .../JavaCompletionTaskTest/1.8/emptyVar.pass       | 126 +++++++++++++++++++++
 .../JavaCompletionTaskTest/1.8/finalAndFWVar.pass  |   2 +
 .../1.8/resourcesAndAutoCloseablesFWVar.pass       |   6 +
 .../JavaCompletionTaskTest/1.8/varKeyword.pass     |   2 +
 .../java/completion/CompletionTestBase.java        |   7 +-
 .../JavaCompletionTask19FeaturesTest.java          |  18 +--
 7 files changed, 152 insertions(+), 13 deletions(-)

diff --git a/java.completion/nbproject/project.xml b/java.completion/nbproject/project.xml
index 4b3df6b..d794eaa 100644
--- a/java.completion/nbproject/project.xml
+++ b/java.completion/nbproject/project.xml
@@ -176,6 +176,10 @@
                         <code-name-base>org.netbeans.modules.parsing.nb</code-name-base>
                     </test-dependency>
                     <test-dependency>
+                        <code-name-base>org.netbeans.modules.project.libraries</code-name-base>
+                        <compile-dependency/>
+                    </test-dependency>
+                    <test-dependency>
                         <code-name-base>org.netbeans.modules.projectapi.nb</code-name-base>
                     </test-dependency>
                 </test-type>
diff --git a/java.completion/test/unit/data/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/1.8/emptyVar.pass b/java.completion/test/unit/data/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/1.8/emptyVar.pass
new file mode 100644
index 0000000..452a824
--- /dev/null
+++ b/java.completion/test/unit/data/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/1.8/emptyVar.pass
@@ -0,0 +1,126 @@
+int a
+boolean b
+protected native Object clone()
+public boolean equals(Object arg0)
+protected void finalize()
+public final native Class<?> getClass()
+public native int hashCode()
+public final native void notify()
+public final native void notifyAll()
+public void op(int a, boolean b)
+public String toString()
+public final void wait()
+public final native void wait(long arg0)
+public final void wait(long arg0, int arg1)
+boolean
+byte
+char
+double
+false
+float
+int
+long
+new
+short
+super
+this
+true
+AbstractMethodError
+Appendable
+ArithmeticException
+ArrayIndexOutOfBoundsException
+ArrayStoreException
+AssertionError
+AutoCloseable
+Boolean
+BootstrapMethodError
+Byte
+CharSequence
+Character
+Class
+ClassCastException
+ClassCircularityError
+ClassFormatError
+ClassLoader
+ClassNotFoundException
+ClassValue
+CloneNotSupportedException
+Cloneable
+Comparable
+Compiler
+Deprecated
+Double
+Enum
+EnumConstantNotPresentException
+Error
+Exception
+ExceptionInInitializerError
+Float
+FunctionalInterface
+IllegalAccessError
+IllegalAccessException
+IllegalArgumentException
+IllegalMonitorStateException
+IllegalStateException
+IllegalThreadStateException
+IncompatibleClassChangeError
+IndexOutOfBoundsException
+InheritableThreadLocal
+InstantiationError
+InstantiationException
+Integer
+InternalError
+InterruptedException
+Iterable
+LinkageError
+Long
+Math
+NegativeArraySizeException
+NoClassDefFoundError
+NoSuchFieldError
+NoSuchFieldException
+NoSuchMethodError
+NoSuchMethodException
+NullPointerException
+Number
+NumberFormatException
+Object
+OutOfMemoryError
+Override
+Package
+Process
+ProcessBuilder
+Readable
+ReflectiveOperationException
+Runnable
+Runtime
+RuntimeException
+RuntimePermission
+SafeVarargs
+SecurityException
+SecurityManager
+Short
+StackOverflowError
+StackTraceElement
+StrictMath
+String
+StringBuffer
+StringBuilder
+StringIndexOutOfBoundsException
+SuppressWarnings
+System
+Test
+Thread
+ThreadDeath
+ThreadGroup
+ThreadLocal
+Throwable
+TypeNotPresentException
+UnknownError
+UnsatisfiedLinkError
+UnsupportedClassVersionError
+UnsupportedOperationException
+VerifyError
+VirtualMachineError
+Void
+java
diff --git a/java.completion/test/unit/data/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/1.8/finalAndFWVar.pass b/java.completion/test/unit/data/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/1.8/finalAndFWVar.pass
new file mode 100644
index 0000000..4be4464
--- /dev/null
+++ b/java.completion/test/unit/data/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/1.8/finalAndFWVar.pass
@@ -0,0 +1,2 @@
+FileWriter fw
+final
diff --git a/java.completion/test/unit/data/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/1.8/resourcesAndAutoCloseablesFWVar.pass b/java.completion/test/unit/data/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/1.8/resourcesAndAutoCloseablesFWVar.pass
new file mode 100644
index 0000000..0b39f8c
--- /dev/null
+++ b/java.completion/test/unit/data/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/1.8/resourcesAndAutoCloseablesFWVar.pass
@@ -0,0 +1,6 @@
+FileWriter fw
+final
+AutoCloseable
+BufferedWriter
+FileWriter
+java
diff --git a/java.completion/test/unit/data/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/1.8/varKeyword.pass b/java.completion/test/unit/data/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/1.8/varKeyword.pass
new file mode 100644
index 0000000..1f7154f
--- /dev/null
+++ b/java.completion/test/unit/data/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/1.8/varKeyword.pass
@@ -0,0 +1,2 @@
+var
+void
diff --git a/java.completion/test/unit/src/org/netbeans/modules/java/completion/CompletionTestBase.java b/java.completion/test/unit/src/org/netbeans/modules/java/completion/CompletionTestBase.java
index 217f8a9..f2485e3 100644
--- a/java.completion/test/unit/src/org/netbeans/modules/java/completion/CompletionTestBase.java
+++ b/java.completion/test/unit/src/org/netbeans/modules/java/completion/CompletionTestBase.java
@@ -224,10 +224,6 @@ public class CompletionTestBase extends NbTestCase {
     }
     
     protected void performTest(String source, int caretPos, String textToInsert, String goldenFileName, String sourceLevel) throws Exception {
-        String version = System.getProperty("java.specification.version");
-        if (com.sun.tools.javac.code.Source.lookup(version).compareTo(com.sun.tools.javac.code.Source.lookup(sourceLevel)) < 0) {
-            sourceLevel = com.sun.tools.javac.code.Source.lookup(version).name;
-        }
         this.sourceLevel.set(sourceLevel);
         File testSource = new File(getWorkDir(), "test/Test.java");
         testSource.getParentFile().mkdirs();
@@ -266,6 +262,7 @@ public class CompletionTestBase extends NbTestCase {
         
         
         File goldenFile = null;
+        String version = System.getProperty("java.specification.version");
         for (String variant : VERSION_VARIANTS.get(version)) {
             goldenFile = new File(getDataDir(), "/goldenfiles/org/netbeans/modules/java/completion/JavaCompletionTaskTest/" + variant + "/" + goldenFileName);
             if (goldenFile.exists())
@@ -286,6 +283,8 @@ public class CompletionTestBase extends NbTestCase {
         VERSION_VARIANTS.put("1.9", Arrays.asList("9", "1.8"));
         VERSION_VARIANTS.put("10", Arrays.asList("10", "9", "1.8"));
         VERSION_VARIANTS.put("1.10", Arrays.asList("10", "9", "1.8"));
+        VERSION_VARIANTS.put("11", Arrays.asList("11", "10", "9", "1.8"));
+        VERSION_VARIANTS.put("1.11", Arrays.asList("11", "10", "9", "1.8"));
     }
 
     private void copyToWorkDir(File resource, File toFile) throws IOException {
diff --git a/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask19FeaturesTest.java b/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask19FeaturesTest.java
index dfc961a..820596a 100644
--- a/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask19FeaturesTest.java
+++ b/java.completion/test/unit/src/org/netbeans/modules/java/completion/JavaCompletionTask19FeaturesTest.java
@@ -33,27 +33,27 @@ public class JavaCompletionTask19FeaturesTest extends CompletionTestBase {
     // Java 1.9 try-with-resources tests -------------------------------------------
     
     public void testEmptyFileBeforeTypingExistingVarResouce() throws Exception {
-        performTest("SimpleTWRStart", 948, "try (", "resourcesAndAutoCloseables.pass", "1.9");
+        performTest("SimpleTWRStart", 948, "try (", "resourcesAndAutoCloseablesFWVar.pass", "1.9");
     }
 
     public void testBeforeTypingExistingVarResouce() throws Exception {
-        performTest("SimpleTWRNoRes", 953, null, "resourcesAndAutoCloseables.pass", "1.9");
+        performTest("SimpleTWRNoRes", 953, null, "resourcesAndAutoCloseablesFWVar.pass", "1.9");
     }
 
     public void testBeforeExistingVarResouce() throws Exception {
-        performTest("SimpleTWR", 981, null, "resourcesAndAutoCloseables.pass", "1.9");
+        performTest("SimpleTWR", 981, null, "resourcesAndAutoCloseablesFWVar.pass", "1.9");
     }
 
     public void testEmptyFileTypingExistingVarResouce() throws Exception {
-        performTest("SimpleTWRStart", 948, "try (f", "finalKeyword.pass", "1.9");
+        performTest("SimpleTWRStart", 948, "try (f", "finalAndFWVar.pass", "1.9");
     }
 
     public void testTypingExistingVarResouce() throws Exception {
-        performTest("SimpleTWRNoRes", 953, "f", "finalKeyword.pass", "1.9");
+        performTest("SimpleTWRNoRes", 953, "f", "finalAndFWVar.pass", "1.9");
     }
 
     public void testOnExistingVarResouce() throws Exception {
-        performTest("SimpleTWR", 982, null, "finalKeyword.pass", "1.9");
+        performTest("SimpleTWR", 982, null, "finalAndFWVar.pass", "1.9");
     }
 
     public void testEmptyFileAfterTypingExistingVarResouce() throws Exception {
@@ -69,15 +69,15 @@ public class JavaCompletionTask19FeaturesTest extends CompletionTestBase {
     }
 
     public void testEmptyFileBeforeTypingNewVarResouce() throws Exception {
-        performTest("SimpleTWRStart", 948, "try (fw;", "resourcesAndAutoCloseables.pass", "1.9");
+        performTest("SimpleTWRStart", 948, "try (fw;", "resourcesAndAutoCloseablesFWVar.pass", "1.9");
     }
 
     public void testBeforeTypingNewVarResouce() throws Exception {
-        performTest("SimpleTWRNoRes", 953, "fw;", "resourcesAndAutoCloseables.pass", "1.9");
+        performTest("SimpleTWRNoRes", 953, "fw;", "resourcesAndAutoCloseablesFWVar.pass", "1.9");
     }
 
     public void testBeforeNewVarResouce() throws Exception {
-        performTest("SimpleTWR", 984, null, "resourcesAndAutoCloseables.pass", "1.9");
+        performTest("SimpleTWR", 984, null, "resourcesAndAutoCloseablesFWVar.pass", "1.9");
     }
 
     static {

-- 
To stop receiving notification emails like this one, please contact
jlahoda@apache.org.

---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@netbeans.apache.org
For additional commands, e-mail: commits-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists