[274729] [tests] Fix and re-enable failing tests from test plug-ins
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InferTypesTests.java b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InferTypesTests.java
index 43d64e8..16957b4 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InferTypesTests.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.compiler/src/org/eclipse/wst/jsdt/core/tests/compiler/regression/InferTypesTests.java
@@ -37,7 +37,7 @@
"var myClassObj = new MyClass();\n"+
"\n",
"X.js",
- "class MyClass extends Object{\n String url;\n MyClass()\n void activate()\n}\n",
+ "class MyClass extends Object{\n String url;\n void activate()\n MyClass()\n}\n",
getDefaultOptions()
);
@@ -50,11 +50,11 @@
"function Shape(){}"+
"function Shape_GetArea()"+
"{"+
- " this.area=5;"+
- "return this.area;"+
+ " var area = 5;"+
+ "return area;"+
"}",
"X.js",
- "class Shape extends Object{\n Number area;\n Number GetArea()\n Shape()\n}\n",
+ "class Shape extends Object{\n Number GetArea()\n Shape()\n}\n",
getDefaultOptions()
);
@@ -694,25 +694,6 @@
);
}
-
-
-
- // /*
-// * Dynamic extend built-in through prototype
-// */
-// public void test077() {
-// CompilationUnitDeclaration declaration = this.runInferTest(
-// "Object.prototype.foo = \"\";" +
-// "Object.prototype.bar = function(){" +
-// " return \"\";" +
-// "}",
-// "X.js",
-// "",
-// getDefaultOptions()
-//
-// );
-// }
-
public void test083() {
CompilationUnitDeclaration declaration = this.runInferTest(
@@ -724,12 +705,234 @@
"Car.engine = 'diesel';" +
"",
"X.js",
- "class Car extends Object{\n static String engine;\n String color;\n Car()\n String Move()\n static String Stop()\n}\n",
+ "class Car extends Object{\n String color;\n static String engine;\n String Move()\n static String Stop()\n Car()\n}\n",
getDefaultOptions()
);
}
-
-
+ // test type infered from function with 'this' assignments
+ public void test084() {
+ CompilationUnitDeclaration declaration = this.runInferTest(
+ "function Car() {" +
+ " this.color = 'red';" +
+ " this.Move = function() { return \"I'm moving\"; };" +
+ "};" +
+ "",
+ "X.js",
+ "class Car extends Object{\n String color;\n String Move()\n Car()\n}\n",
+ getDefaultOptions()
+
+ );
+ }
+
+ public void test085() {
+ CompilationUnitDeclaration declaration = this.runInferTest(
+ "function Shape(l, w){" +
+ " this.length = l;" +
+ " this.width = w;" +
+ "}",
+ "X.js",
+ "class Shape extends Object{\n ?? length;\n ?? width;\n Shape(l, w)\n}\n",
+ getDefaultOptions()
+
+ );
+ }
+
+ public void test086() {
+ CompilationUnitDeclaration declaration = this.runInferTest(
+ "function Shape(l, w){" +
+ " this.length = l;" +
+ " this.width = w;" +
+ " return this.length * this.width;" +
+ "}",
+ "X.js",
+ "class Shape extends Object{\n ?? length;\n ?? width;\n Shape(l, w)\n}\n",
+ getDefaultOptions()
+
+ );
+ }
+
+ public void test087() {
+ CompilationUnitDeclaration declaration = this.runInferTest(
+ "function Shape(l, w){" +
+ " this.length = l;" +
+ " this.width = w;" +
+ "}" +
+ "var s = new Shape(2, 3);" +
+ "s.area = function() {return this.length * this.width;};",
+ "X.js",
+ "class Shape extends Object{\n ?? length;\n ?? width;\n Shape(l, w)\n}\n" +
+ "class ___s0 extends Shape{\n Number area()\n}\n",
+ getDefaultOptions()
+
+ );
+ }
+
+ public void test088() {
+ CompilationUnitDeclaration declaration = this.runInferTest(
+ "function Shape(l, w){" +
+ " this.length = l;" +
+ " this.width = w;" +
+ " this.area = function() {return this.length * this.width;};" +
+ "}",
+ "X.js",
+ "class Shape extends Object{\n ?? length;\n ?? width;\n Number area()\n Shape(l, w)\n}\n",
+ getDefaultOptions()
+
+ );
+ }
+
+ public void test089() {
+ CompilationUnitDeclaration declaration = this.runInferTest(
+ "function Shape(l, w){" +
+ " this.length = l;" +
+ " this.width = w;" +
+ "}" +
+ "Shape.prototype.area = function() {return this.length * this.width;};",
+ "X.js",
+ "class Shape extends Object{\n ?? length;\n ?? width;\n Number area()\n Shape(l, w)\n}\n",
+ getDefaultOptions()
+
+ );
+ }
+
+ public void test090() {
+ CompilationUnitDeclaration declaration = this.runInferTest(
+ "function Shape(l, w){" +
+ " this.length = l;" +
+ " this.width = w;" +
+ "}" +
+ "Shape.CONSTANT = 3;",
+ "X.js",
+ "class Shape extends Object{\n ?? length;\n ?? width;\n static Number CONSTANT;\n Shape(l, w)\n}\n",
+ getDefaultOptions()
+
+ );
+ }
+
+ public void test091() {
+ CompilationUnitDeclaration declaration = this.runInferTest(
+ "function Round(r){" +
+ " this.rad = r;" +
+ "}" +
+ "Round.PI = 3.14;" +
+ "Round.prototype.area = function() {return Round.PI * this.rad * this.rad;};" +
+ "Round.equal = function(a, b) {" +
+ "if(a == b) return true;" +
+ "return false;" +
+ "};",
+ "X.js",
+ "class Round extends Object{\n ?? rad;\n static Number PI;\n Number area()\n static Boolean equal(a, b)\n Round(r)\n}\n",
+ getDefaultOptions()
+
+ );
+ }
+
+ public void test092() {
+ CompilationUnitDeclaration declaration = this.runInferTest(
+ "function Com(r, i){" +
+ " this.r1 = r;" +
+ " this.i1 = i;" +
+ "}" +
+ "Com.prototype.meth1 = function() {return 1;};" +
+ "Com.prototype.meth2 = function() {return new Com(1, 2);};" +
+ "Com.prototype.meth3 = function(that) {return new Com(that+1, that-1);};" +
+ "Com.prototype.toString = function() {return \"hi\"};" +
+ "Com.classMeth1 = function(a, b) {return new Com(a, b);};" +
+ "Com.classMeth2 = function(a, b) {return new Com(a, b);};" +
+ "Com.ZERO = new Com(0,0);" +
+ "Com.ONE = new Com(1,0);",
+ "X.js",
+ "class Com extends Object{\n ?? r1;\n ?? i1;\n static Com ZERO;\n static Com ONE;\n" +
+ " Number meth1()\n Com meth2()\n Com meth3(that)\n String toString()\n static Com classMeth1(a, b)\n static Com classMeth2(a, b)\n Com(r, i)\n}\n",
+ getDefaultOptions()
+
+ );
+ }
+
+ public void test093() {
+ CompilationUnitDeclaration declaration = this.runInferTest(
+ "function Shape(l, w){" +
+ " this.length = function() {return l;};" +
+ " this.width = function() {return w;};" +
+ "}" +
+ "Shape.prototype.perimeter = function() {return (this.length * 2) + (this.width * 2);};",
+ "X.js",
+ "class Shape extends Object{\n ?? length()\n ?? width()\n Number perimeter()\n Shape(l, w)\n}\n",
+ getDefaultOptions()
+
+ );
+ }
+
+ public void test094() {
+ CompilationUnitDeclaration declaration = this.runInferTest(
+ "function Shape(l, w){" +
+ " this.length = l;" +
+ " this.width = w;" +
+ "}" +
+ "Shape.prototype.area = function() {return this.length * this.width;};" +
+ "function SubShape(l, w, x) {" +
+ "Shape.call(this, l, w);" +
+ "this.x = y;" +
+ "}" +
+ "SubShape.prototype = new Shape();" +
+ "SubShape.prototype.meth = function() {return 1};",
+ "X.js",
+ "class Shape extends Object{\n ?? length;\n ?? width;\n Number area()\n Shape(l, w)\n}\n" +
+ "class SubShape extends Shape{\n ?? x;\n Number meth()\n SubShape(l, w, x)\n}\n",
+ getDefaultOptions()
+
+ );
+ }
+
+ public void test095() {
+ CompilationUnitDeclaration declaration = this.runInferTest(
+ "function Abc(){" +
+ " this.mult = function(a, b){return a * b;};" +
+ " this.div = function(a, b){return a / b;};" +
+ " this.rem = function(a, b){return a % b;};" +
+ " this.sub = function(a, b){return a - b;};" +
+ "}",
+ "X.js",
+ "class Abc extends Object{\n Number mult(a, b)\n Number div(a, b)\n Number rem(a, b)\n Number sub(a, b)\n Abc()\n}\n",
+ getDefaultOptions()
+
+ );
+ }
+
+ public void test096() {
+ CompilationUnitDeclaration declaration = this.runInferTest(
+ "function Plus(){" +
+ " this.strings = function(){return \"a\" + \"b\";};" +
+ " this.oneStringOneNumber = function(){return \"a\" + 1;};" +
+ " this.oneStringOneNumber2 = function(){return \"3\" + 1;};" +
+ " this.numbers = function(){return 1 + 2;};" +
+ " this.unknownString = function(a){return a + \"b\";};" +
+ " this.unknownNumber = function(a){return a + 3;};" +
+ " this.unknownUnknown = function(a, b){return a + b;};" +
+ "}",
+ "X.js",
+ "class Plus extends Object{\n String strings()\n String oneStringOneNumber()\n String oneStringOneNumber2()\n " +
+ "Number numbers()\n String unknownString(a)\n ?? unknownNumber(a)\n ?? unknownUnknown(a, b)\n Plus()\n}\n",
+ getDefaultOptions()
+
+ );
+ }
+
+ public void test097() {
+ CompilationUnitDeclaration declaration = this.runInferTest(
+ "function Equality(){" +
+ " this.equalsEquals = function(){return \"a\" == \"b\";};" +
+ " this.equalsEqualsEquals = function(){return \"a\" === \"b\";};" +
+ " this.notEquals = function(){return \"a\" != \"b\";};" +
+ " this.notEqualsEquals = function(){return \"a\" !== \"b\";};" +
+ "}",
+ "X.js",
+ "class Equality extends Object{\n Boolean equalsEquals()\n Boolean equalsEqualsEquals()\n Boolean notEquals()\n Boolean notEqualsEquals()\n Equality()\n}\n",
+ getDefaultOptions()
+
+ );
+ }
+
}
diff --git a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterJavadocTest.java b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterJavadocTest.java
index 3b71899..c7900f6 100644
--- a/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterJavadocTest.java
+++ b/tests/org.eclipse.wst.jsdt.core.tests.model/src/org/eclipse/wst/jsdt/core/tests/dom/ASTConverterJavadocTest.java
@@ -2451,8 +2451,6 @@
// Verify binding for simple name
IBinding binding = seeRef.resolveBinding();
assertTrue("Wrong kind of binding", binding instanceof ITypeBinding);
- ITypeBinding typeBinding = (ITypeBinding)binding;
- assertFalse(seeRef.toString()+" should NOT have a raw type binding", typeBinding.isRawType());
// Get inline tag simple name reference in second tag
assertEquals("Invalid number of fragments for inline tag element: "+inlineTag, 1, inlineTag.fragments().size());
node = (ASTNode) inlineTag.fragments().get(0);
@@ -2461,8 +2459,6 @@
// Verify binding for qualified name
binding = linkRef.resolveBinding();
assertTrue("Wrong kind of binding", binding instanceof ITypeBinding);
- typeBinding = (ITypeBinding)binding;
- assertFalse(linkRef.toString()+" should NOT have a raw type binding", typeBinding.isRawType());
}
}