More tests

This commit is contained in:
Jason Freeman 2015-02-24 11:31:42 -08:00
parent 3d5c113bee
commit 057108646d
15 changed files with 498 additions and 0 deletions

View file

@ -0,0 +1,41 @@
//// [for-of19.ts]
for (var v of new FooIterator) {
v;
}
class Foo { }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
//// [for-of19.js]
for (var v of new FooIterator) {
v;
}
var Foo = (function () {
function Foo() {
}
return Foo;
})();
var FooIterator = (function () {
function FooIterator() {
}
FooIterator.prototype.next = function () {
return {
value: new Foo,
done: false
};
};
FooIterator.prototype[Symbol.iterator] = function () {
return this;
};
return FooIterator;
})();

View file

@ -0,0 +1,41 @@
=== tests/cases/conformance/es6/for-ofStatements/for-of19.ts ===
for (var v of new FooIterator) {
>v : Foo
>new FooIterator : FooIterator
>FooIterator : typeof FooIterator
v;
>v : Foo
}
class Foo { }
>Foo : Foo
class FooIterator {
>FooIterator : FooIterator
next() {
>next : () => { value: Foo; done: boolean; }
return {
>{ value: new Foo, done: false } : { value: Foo; done: boolean; }
value: new Foo,
>value : Foo
>new Foo : Foo
>Foo : typeof Foo
done: false
>done : boolean
};
}
[Symbol.iterator]() {
>Symbol.iterator : symbol
>Symbol : SymbolConstructor
>iterator : symbol
return this;
>this : FooIterator
}
}

View file

@ -0,0 +1,41 @@
//// [for-of20.ts]
for (let v of new FooIterator) {
v;
}
class Foo { }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
//// [for-of20.js]
for (let v of new FooIterator) {
v;
}
var Foo = (function () {
function Foo() {
}
return Foo;
})();
var FooIterator = (function () {
function FooIterator() {
}
FooIterator.prototype.next = function () {
return {
value: new Foo,
done: false
};
};
FooIterator.prototype[Symbol.iterator] = function () {
return this;
};
return FooIterator;
})();

View file

@ -0,0 +1,41 @@
=== tests/cases/conformance/es6/for-ofStatements/for-of20.ts ===
for (let v of new FooIterator) {
>v : Foo
>new FooIterator : FooIterator
>FooIterator : typeof FooIterator
v;
>v : Foo
}
class Foo { }
>Foo : Foo
class FooIterator {
>FooIterator : FooIterator
next() {
>next : () => { value: Foo; done: boolean; }
return {
>{ value: new Foo, done: false } : { value: Foo; done: boolean; }
value: new Foo,
>value : Foo
>new Foo : Foo
>Foo : typeof Foo
done: false
>done : boolean
};
}
[Symbol.iterator]() {
>Symbol.iterator : symbol
>Symbol : SymbolConstructor
>iterator : symbol
return this;
>this : FooIterator
}
}

View file

@ -0,0 +1,41 @@
//// [for-of21.ts]
for (const v of new FooIterator) {
v;
}
class Foo { }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
//// [for-of21.js]
for (var v of new FooIterator) {
v;
}
var Foo = (function () {
function Foo() {
}
return Foo;
})();
var FooIterator = (function () {
function FooIterator() {
}
FooIterator.prototype.next = function () {
return {
value: new Foo,
done: false
};
};
FooIterator.prototype[Symbol.iterator] = function () {
return this;
};
return FooIterator;
})();

View file

@ -0,0 +1,41 @@
=== tests/cases/conformance/es6/for-ofStatements/for-of21.ts ===
for (const v of new FooIterator) {
>v : Foo
>new FooIterator : FooIterator
>FooIterator : typeof FooIterator
v;
>v : Foo
}
class Foo { }
>Foo : Foo
class FooIterator {
>FooIterator : FooIterator
next() {
>next : () => { value: Foo; done: boolean; }
return {
>{ value: new Foo, done: false } : { value: Foo; done: boolean; }
value: new Foo,
>value : Foo
>new Foo : Foo
>Foo : typeof Foo
done: false
>done : boolean
};
}
[Symbol.iterator]() {
>Symbol.iterator : symbol
>Symbol : SymbolConstructor
>iterator : symbol
return this;
>this : FooIterator
}
}

View file

@ -0,0 +1,42 @@
//// [for-of22.ts]
v;
for (var v of new FooIterator) {
}
class Foo { }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
//// [for-of22.js]
v;
for (var v of new FooIterator) {
}
var Foo = (function () {
function Foo() {
}
return Foo;
})();
var FooIterator = (function () {
function FooIterator() {
}
FooIterator.prototype.next = function () {
return {
value: new Foo,
done: false
};
};
FooIterator.prototype[Symbol.iterator] = function () {
return this;
};
return FooIterator;
})();

View file

@ -0,0 +1,42 @@
=== tests/cases/conformance/es6/for-ofStatements/for-of22.ts ===
v;
>v : Foo
for (var v of new FooIterator) {
>v : Foo
>new FooIterator : FooIterator
>FooIterator : typeof FooIterator
}
class Foo { }
>Foo : Foo
class FooIterator {
>FooIterator : FooIterator
next() {
>next : () => { value: Foo; done: boolean; }
return {
>{ value: new Foo, done: false } : { value: Foo; done: boolean; }
value: new Foo,
>value : Foo
>new Foo : Foo
>Foo : typeof Foo
done: false
>done : boolean
};
}
[Symbol.iterator]() {
>Symbol.iterator : symbol
>Symbol : SymbolConstructor
>iterator : symbol
return this;
>this : FooIterator
}
}

View file

@ -0,0 +1,41 @@
//// [for-of23.ts]
for (const v of new FooIterator) {
const v = 0; // new scope
}
class Foo { }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}
//// [for-of23.js]
for (var v of new FooIterator) {
const v = 0; // new scope
}
var Foo = (function () {
function Foo() {
}
return Foo;
})();
var FooIterator = (function () {
function FooIterator() {
}
FooIterator.prototype.next = function () {
return {
value: new Foo,
done: false
};
};
FooIterator.prototype[Symbol.iterator] = function () {
return this;
};
return FooIterator;
})();

View file

@ -0,0 +1,41 @@
=== tests/cases/conformance/es6/for-ofStatements/for-of23.ts ===
for (const v of new FooIterator) {
>v : Foo
>new FooIterator : FooIterator
>FooIterator : typeof FooIterator
const v = 0; // new scope
>v : number
}
class Foo { }
>Foo : Foo
class FooIterator {
>FooIterator : FooIterator
next() {
>next : () => { value: Foo; done: boolean; }
return {
>{ value: new Foo, done: false } : { value: Foo; done: boolean; }
value: new Foo,
>value : Foo
>new Foo : Foo
>Foo : typeof Foo
done: false
>done : boolean
};
}
[Symbol.iterator]() {
>Symbol.iterator : symbol
>Symbol : SymbolConstructor
>iterator : symbol
return this;
>this : FooIterator
}
}

View file

@ -0,0 +1,17 @@
//@target: ES6
for (var v of new FooIterator) {
v;
}
class Foo { }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View file

@ -0,0 +1,17 @@
//@target: ES6
for (let v of new FooIterator) {
v;
}
class Foo { }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View file

@ -0,0 +1,17 @@
//@target: ES6
for (const v of new FooIterator) {
v;
}
class Foo { }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View file

@ -0,0 +1,18 @@
//@target: ES6
v;
for (var v of new FooIterator) {
}
class Foo { }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}

View file

@ -0,0 +1,17 @@
//@target: ES6
for (const v of new FooIterator) {
const v = 0; // new scope
}
class Foo { }
class FooIterator {
next() {
return {
value: new Foo,
done: false
};
}
[Symbol.iterator]() {
return this;
}
}