mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-02-06 02:33:53 -06:00
added baselines for new tests
This commit is contained in:
parent
a8d205a2fc
commit
676f4a17ee
@ -0,0 +1,16 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractCrashedOnce.ts(8,5): error TS1003: Identifier expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractCrashedOnce.ts (1 errors) ====
|
||||
abstract class foo {
|
||||
protected abstract test();
|
||||
}
|
||||
|
||||
class bar extends foo {
|
||||
test() {
|
||||
this.
|
||||
}
|
||||
~
|
||||
!!! error TS1003: Identifier expected.
|
||||
}
|
||||
var x = new bar();
|
||||
35
tests/baselines/reference/classAbstractCrashedOnce.js
Normal file
35
tests/baselines/reference/classAbstractCrashedOnce.js
Normal file
@ -0,0 +1,35 @@
|
||||
//// [classAbstractCrashedOnce.ts]
|
||||
abstract class foo {
|
||||
protected abstract test();
|
||||
}
|
||||
|
||||
class bar extends foo {
|
||||
test() {
|
||||
this.
|
||||
}
|
||||
}
|
||||
var x = new bar();
|
||||
|
||||
//// [classAbstractCrashedOnce.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var foo = (function () {
|
||||
function foo() {
|
||||
}
|
||||
return foo;
|
||||
})();
|
||||
var bar = (function (_super) {
|
||||
__extends(bar, _super);
|
||||
function bar() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
bar.prototype.test = function () {
|
||||
this.
|
||||
;
|
||||
};
|
||||
return bar;
|
||||
})(foo);
|
||||
var x = new bar();
|
||||
@ -0,0 +1,19 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractImportInstantiation.ts(4,5): error TS2511: Cannot create an instance of the abstract class 'A'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractImportInstantiation.ts(9,1): error TS2511: Cannot create an instance of the abstract class 'A'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractImportInstantiation.ts (2 errors) ====
|
||||
module M {
|
||||
export abstract class A {}
|
||||
|
||||
new A;
|
||||
~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'A'.
|
||||
}
|
||||
|
||||
import myA = M.A;
|
||||
|
||||
new myA;
|
||||
~~~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'A'.
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
//// [classAbstractImportInstantiation.ts]
|
||||
module M {
|
||||
export abstract class A {}
|
||||
|
||||
new A;
|
||||
}
|
||||
|
||||
import myA = M.A;
|
||||
|
||||
new myA;
|
||||
|
||||
|
||||
//// [classAbstractImportInstantiation.js]
|
||||
var M;
|
||||
(function (M) {
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
M.A = A;
|
||||
new A;
|
||||
})(M || (M = {}));
|
||||
var myA = M.A;
|
||||
new myA;
|
||||
@ -0,0 +1,28 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations1.ts(8,1): error TS2511: Cannot create an instance of the abstract class 'A'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations1.ts(10,1): error TS2511: Cannot create an instance of the abstract class 'C'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations1.ts (2 errors) ====
|
||||
|
||||
abstract class A {}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
abstract class C extends B {}
|
||||
|
||||
new A;
|
||||
~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'A'.
|
||||
new B;
|
||||
new C;
|
||||
~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'C'.
|
||||
|
||||
var a : A;
|
||||
var b : B;
|
||||
var c : C;
|
||||
|
||||
a = new B;
|
||||
b = new B;
|
||||
c = new B;
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
//// [classInstantiatingAbstractClass.ts]
|
||||
//// [classAbstractInstantiations1.ts]
|
||||
|
||||
abstract class A {}
|
||||
|
||||
@ -17,17 +17,9 @@ var c : C;
|
||||
a = new B;
|
||||
b = new B;
|
||||
c = new B;
|
||||
|
||||
module M {
|
||||
export abstract class A {}
|
||||
}
|
||||
|
||||
import myA = M.A;
|
||||
|
||||
var aa = new myA;
|
||||
|
||||
|
||||
//// [classInstantiatingAbstractClass.js]
|
||||
//// [classAbstractInstantiations1.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
@ -61,14 +53,3 @@ var c;
|
||||
a = new B;
|
||||
b = new B;
|
||||
c = new B;
|
||||
var M;
|
||||
(function (M) {
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
M.A = A;
|
||||
})(M || (M = {}));
|
||||
var myA = M.A;
|
||||
var aa = new myA;
|
||||
@ -0,0 +1,90 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(6,28): error TS2304: Cannot find name 'bar'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(10,1): error TS2511: Cannot create an instance of the abstract class 'B'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(17,5): error TS2511: Cannot create an instance of the abstract class 'B'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(21,1): error TS2511: Cannot create an instance of the abstract class 'B'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(26,7): error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'B.bar'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(45,14): error TS2516: All declarations of an abstract method must be consecutive.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(45,20): error TS1144: '{' or ';' expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(45,20): error TS2300: Duplicate identifier 'boolean'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(46,5): error TS2512: Overload signatures must all be `abstract` or not `abstract.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(46,21): error TS1144: '{' or ';' expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(46,21): error TS2300: Duplicate identifier 'boolean'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts(49,7): error TS2514: Classes containing abstract functions must be marked abstract.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractInstantiations2.ts (12 errors) ====
|
||||
class A {
|
||||
// ...
|
||||
}
|
||||
|
||||
abstract class B {
|
||||
foo(): number { return bar(); }
|
||||
~~~
|
||||
!!! error TS2304: Cannot find name 'bar'.
|
||||
abstract bar() : number;
|
||||
}
|
||||
|
||||
new B; // error
|
||||
~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'B'.
|
||||
|
||||
var BB: typeof B = B;
|
||||
var AA: typeof A = BB; // error, AA is not of abstract type.
|
||||
new AA;
|
||||
|
||||
function constructB(Factory : typeof B) {
|
||||
new Factory; // error -- Factory is of type typeof C
|
||||
~~~~~~~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'B'.
|
||||
}
|
||||
|
||||
var BB = B;
|
||||
new BB; // error -- BB is of type typeof C
|
||||
~~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'B'.
|
||||
|
||||
var x : any = C;
|
||||
new x; // okay -- undefined behavior at runtime
|
||||
|
||||
class C extends B { } // error -- not declared abstract
|
||||
~
|
||||
!!! error TS2515: Non-abstract class 'C' does not implement inherited abstract member 'B.bar'.
|
||||
|
||||
abstract class D extends B { } // okay
|
||||
|
||||
class E extends B { // okay -- implements abstract method
|
||||
bar() { return 1; }
|
||||
}
|
||||
|
||||
abstract class F extends B {
|
||||
abstract foo() : number;
|
||||
bar() { return 2; }
|
||||
}
|
||||
|
||||
abstract class G {
|
||||
abstract qux(x : number) : string;
|
||||
abstract qux() : number;
|
||||
y : number;
|
||||
abstract quz(x : number, y : string) : boolean; // error -- declarations must be adjacent
|
||||
|
||||
abstract nom() boolean;
|
||||
~~~
|
||||
!!! error TS2516: All declarations of an abstract method must be consecutive.
|
||||
~~~~~~~
|
||||
!!! error TS1144: '{' or ';' expected.
|
||||
~~~~~~~
|
||||
!!! error TS2300: Duplicate identifier 'boolean'.
|
||||
nom(x : number) boolean; // error -- use of modifier abstract must match on all overloads.
|
||||
~~~
|
||||
!!! error TS2512: Overload signatures must all be `abstract` or not `abstract.
|
||||
~~~~~~~
|
||||
!!! error TS1144: '{' or ';' expected.
|
||||
~~~~~~~
|
||||
!!! error TS2300: Duplicate identifier 'boolean'.
|
||||
}
|
||||
|
||||
class H { // error -- not declared abstract
|
||||
~
|
||||
!!! error TS2514: Classes containing abstract functions must be marked abstract.
|
||||
abstract baz() : number;
|
||||
}
|
||||
123
tests/baselines/reference/classAbstractInstantiations2.js
Normal file
123
tests/baselines/reference/classAbstractInstantiations2.js
Normal file
@ -0,0 +1,123 @@
|
||||
//// [classAbstractInstantiations2.ts]
|
||||
class A {
|
||||
// ...
|
||||
}
|
||||
|
||||
abstract class B {
|
||||
foo(): number { return bar(); }
|
||||
abstract bar() : number;
|
||||
}
|
||||
|
||||
new B; // error
|
||||
|
||||
var BB: typeof B = B;
|
||||
var AA: typeof A = BB; // error, AA is not of abstract type.
|
||||
new AA;
|
||||
|
||||
function constructB(Factory : typeof B) {
|
||||
new Factory; // error -- Factory is of type typeof C
|
||||
}
|
||||
|
||||
var BB = B;
|
||||
new BB; // error -- BB is of type typeof C
|
||||
|
||||
var x : any = C;
|
||||
new x; // okay -- undefined behavior at runtime
|
||||
|
||||
class C extends B { } // error -- not declared abstract
|
||||
|
||||
abstract class D extends B { } // okay
|
||||
|
||||
class E extends B { // okay -- implements abstract method
|
||||
bar() { return 1; }
|
||||
}
|
||||
|
||||
abstract class F extends B {
|
||||
abstract foo() : number;
|
||||
bar() { return 2; }
|
||||
}
|
||||
|
||||
abstract class G {
|
||||
abstract qux(x : number) : string;
|
||||
abstract qux() : number;
|
||||
y : number;
|
||||
abstract quz(x : number, y : string) : boolean; // error -- declarations must be adjacent
|
||||
|
||||
abstract nom() boolean;
|
||||
nom(x : number) boolean; // error -- use of modifier abstract must match on all overloads.
|
||||
}
|
||||
|
||||
class H { // error -- not declared abstract
|
||||
abstract baz() : number;
|
||||
}
|
||||
|
||||
//// [classAbstractInstantiations2.js]
|
||||
var __extends = (this && this.__extends) || function (d, b) {
|
||||
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
};
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var B = (function () {
|
||||
function B() {
|
||||
}
|
||||
B.prototype.foo = function () { return bar(); };
|
||||
return B;
|
||||
})();
|
||||
new B; // error
|
||||
var BB = B;
|
||||
var AA = BB; // error, AA is not of abstract type.
|
||||
new AA;
|
||||
function constructB(Factory) {
|
||||
new Factory; // error -- Factory is of type typeof C
|
||||
}
|
||||
var BB = B;
|
||||
new BB; // error -- BB is of type typeof C
|
||||
var x = C;
|
||||
new x; // okay -- undefined behavior at runtime
|
||||
var C = (function (_super) {
|
||||
__extends(C, _super);
|
||||
function C() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return C;
|
||||
})(B); // error -- not declared abstract
|
||||
var D = (function (_super) {
|
||||
__extends(D, _super);
|
||||
function D() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
return D;
|
||||
})(B); // okay
|
||||
var E = (function (_super) {
|
||||
__extends(E, _super);
|
||||
function E() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
E.prototype.bar = function () { return 1; };
|
||||
return E;
|
||||
})(B);
|
||||
var F = (function (_super) {
|
||||
__extends(F, _super);
|
||||
function F() {
|
||||
_super.apply(this, arguments);
|
||||
}
|
||||
F.prototype.bar = function () { return 2; };
|
||||
return F;
|
||||
})(B);
|
||||
var G = (function () {
|
||||
function G() {
|
||||
}
|
||||
G.prototype.nom = ;
|
||||
G.prototype.nom = ;
|
||||
return G;
|
||||
})();
|
||||
var H = (function () {
|
||||
function H() {
|
||||
}
|
||||
return H;
|
||||
})();
|
||||
@ -0,0 +1,19 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(1,1): error TS1148: Cannot compile modules unless the '--module' flag is provided.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(1,25): error TS1005: ';' expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(3,1): error TS1128: Declaration or statement expected.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts(4,17): error TS1005: '=' expected.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractManyKeywords.ts (4 errors) ====
|
||||
export default abstract class A {}
|
||||
~~~~~~~~~~~~~~~~~~~~~~~
|
||||
!!! error TS1148: Cannot compile modules unless the '--module' flag is provided.
|
||||
~~~~~
|
||||
!!! error TS1005: ';' expected.
|
||||
export abstract class B {}
|
||||
default abstract class C {}
|
||||
~~~~~~~
|
||||
!!! error TS1128: Declaration or statement expected.
|
||||
import abstract class D {}
|
||||
~~~~~
|
||||
!!! error TS1005: '=' expected.
|
||||
28
tests/baselines/reference/classAbstractManyKeywords.js
Normal file
28
tests/baselines/reference/classAbstractManyKeywords.js
Normal file
@ -0,0 +1,28 @@
|
||||
//// [classAbstractManyKeywords.ts]
|
||||
export default abstract class A {}
|
||||
export abstract class B {}
|
||||
default abstract class C {}
|
||||
import abstract class D {}
|
||||
|
||||
//// [classAbstractManyKeywords.js]
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var B = (function () {
|
||||
function B() {
|
||||
}
|
||||
return B;
|
||||
})();
|
||||
exports.B = B;
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
var D = (function () {
|
||||
function D() {
|
||||
}
|
||||
return D;
|
||||
})();
|
||||
@ -0,0 +1,24 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMultiLineDecl.ts(10,1): error TS2511: Cannot create an instance of the abstract class 'A'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMultiLineDecl.ts(11,1): error TS2511: Cannot create an instance of the abstract class 'B'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMultiLineDecl.ts(12,1): error TS2511: Cannot create an instance of the abstract class 'C'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classAbstractMultiLineDecl.ts (3 errors) ====
|
||||
abstract class A {}
|
||||
|
||||
abstract
|
||||
class B {}
|
||||
|
||||
abstract
|
||||
|
||||
class C {}
|
||||
|
||||
new A;
|
||||
~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'A'.
|
||||
new B;
|
||||
~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'B'.
|
||||
new C;
|
||||
~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'C'.
|
||||
33
tests/baselines/reference/classAbstractMultiLineDecl.js
Normal file
33
tests/baselines/reference/classAbstractMultiLineDecl.js
Normal file
@ -0,0 +1,33 @@
|
||||
//// [classAbstractMultiLineDecl.ts]
|
||||
abstract class A {}
|
||||
|
||||
abstract
|
||||
class B {}
|
||||
|
||||
abstract
|
||||
|
||||
class C {}
|
||||
|
||||
new A;
|
||||
new B;
|
||||
new C;
|
||||
|
||||
//// [classAbstractMultiLineDecl.js]
|
||||
var A = (function () {
|
||||
function A() {
|
||||
}
|
||||
return A;
|
||||
})();
|
||||
var B = (function () {
|
||||
function B() {
|
||||
}
|
||||
return B;
|
||||
})();
|
||||
var C = (function () {
|
||||
function C() {
|
||||
}
|
||||
return C;
|
||||
})();
|
||||
new A;
|
||||
new B;
|
||||
new C;
|
||||
@ -1,39 +0,0 @@
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classInstantiatingAbstractClass.ts(8,1): error TS2511: Cannot create an instance of the abstract class 'A'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classInstantiatingAbstractClass.ts(10,1): error TS2511: Cannot create an instance of the abstract class 'C'.
|
||||
tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classInstantiatingAbstractClass.ts(26,10): error TS2511: Cannot create an instance of the abstract class 'A'.
|
||||
|
||||
|
||||
==== tests/cases/conformance/classes/classDeclarations/classAbstractKeyword/classInstantiatingAbstractClass.ts (3 errors) ====
|
||||
|
||||
abstract class A {}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
abstract class C extends B {}
|
||||
|
||||
new A;
|
||||
~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'A'.
|
||||
new B;
|
||||
new C;
|
||||
~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'C'.
|
||||
|
||||
var a : A;
|
||||
var b : B;
|
||||
var c : C;
|
||||
|
||||
a = new B;
|
||||
b = new B;
|
||||
c = new B;
|
||||
|
||||
module M {
|
||||
export abstract class A {}
|
||||
}
|
||||
|
||||
import myA = M.A;
|
||||
|
||||
var aa = new myA;
|
||||
~~~~~~~
|
||||
!!! error TS2511: Cannot create an instance of the abstract class 'A'.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user