Add additional test-cases for arrow function grammar

As suggested by @DanielRosenwasser
This commit is contained in:
Caitlin Potter
2015-03-10 17:20:28 -04:00
parent dd16fed21e
commit 231f522d89
3 changed files with 97 additions and 1 deletions

View File

@@ -8,9 +8,13 @@ tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(1
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(15,10): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(19,5): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(21,5): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(26,40): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(30,20): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(35,17): error TS1200: Line terminator not permitted before arrow.
tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(39,20): error TS1200: Line terminator not permitted before arrow.
==== tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts (10 errors) ====
==== tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts (14 errors) ====
var f1 = ()
~~
=> { }
@@ -63,4 +67,35 @@ tests/cases/conformance/es6/arrowFunction/disallowLineTerminatorBeforeArrow.ts(2
=> { return false; });
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1200: Line terminator not permitted before arrow.
module m {
class City {
constructor(x: number, thing = ()
~~
=> 100) {
~~~~~~~~~~~~~~~~~~
!!! error TS1200: Line terminator not permitted before arrow.
}
public m = ()
~~
=> 2 * 2 * 2
~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1200: Line terminator not permitted before arrow.
}
export enum Enum {
claw = (()
~~
=> 10)()
~~~~~~~~~~~~~~~~~
!!! error TS1200: Line terminator not permitted before arrow.
}
export var v = x
~
=> new City(Enum.claw);
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
!!! error TS1200: Line terminator not permitted before arrow.
}

View File

@@ -21,6 +21,25 @@ foo(()
=> true);
foo(()
=> { return false; });
module m {
class City {
constructor(x: number, thing = ()
=> 100) {
}
public m = ()
=> 2 * 2 * 2
}
export enum Enum {
claw = (()
=> 10)()
}
export var v = x
=> new City(Enum.claw);
}
//// [disallowLineTerminatorBeforeArrow.js]
@@ -66,3 +85,26 @@ foo(function () {
foo(function () {
return false;
});
var m;
(function (m) {
var City = (function () {
function City(x, thing) {
if (thing === void 0) { thing = function () {
return 100;
}; }
this.m = function () {
return 2 * 2 * 2;
};
}
return City;
})();
(function (Enum) {
Enum[Enum["claw"] = (function () {
return 10;
})()] = "claw";
})(m.Enum || (m.Enum = {}));
var Enum = m.Enum;
m.v = function (x) {
return new City(Enum.claw);
};
})(m || (m = {}));

View File

@@ -20,3 +20,22 @@ foo(()
=> true);
foo(()
=> { return false; });
module m {
class City {
constructor(x: number, thing = ()
=> 100) {
}
public m = ()
=> 2 * 2 * 2
}
export enum Enum {
claw = (()
=> 10)()
}
export var v = x
=> new City(Enum.claw);
}