From 1d5725dd793d7d78a3615dab70597cb11b6d8965 Mon Sep 17 00:00:00 2001 From: Nathan Shively-Sanders Date: Wed, 4 Nov 2015 09:54:38 -0800 Subject: [PATCH] Add tests and accept baselines --- .../baselines/reference/tupleKinds.errors.txt | 46 ++++++++++++++++++- tests/baselines/reference/tupleKinds.js | 17 ++++++- tests/cases/compiler/tupleKinds.ts | 8 +++- 3 files changed, 67 insertions(+), 4 deletions(-) diff --git a/tests/baselines/reference/tupleKinds.errors.txt b/tests/baselines/reference/tupleKinds.errors.txt index 0ff27a657d761..d741ff28aaf4f 100644 --- a/tests/baselines/reference/tupleKinds.errors.txt +++ b/tests/baselines/reference/tupleKinds.errors.txt @@ -1,10 +1,52 @@ tests/cases/compiler/tupleKinds.ts(1,22): error TS2370: A rest parameter must be of an array type. +tests/cases/compiler/tupleKinds.ts(4,44): error TS1144: '{' or ';' expected. +tests/cases/compiler/tupleKinds.ts(4,44): error TS2304: Cannot find name 'is'. +tests/cases/compiler/tupleKinds.ts(4,47): error TS1005: ';' expected. +tests/cases/compiler/tupleKinds.ts(4,47): error TS2304: Cannot find name 'boolean'. +tests/cases/compiler/tupleKinds.ts(4,55): error TS1005: ';' expected. +tests/cases/compiler/tupleKinds.ts(6,45): error TS1144: '{' or ';' expected. +tests/cases/compiler/tupleKinds.ts(6,46): error TS2304: Cannot find name 'U'. +tests/cases/compiler/tupleKinds.ts(8,29): error TS1005: '>' expected. +tests/cases/compiler/tupleKinds.ts(8,37): error TS2304: Cannot find name 'string'. +tests/cases/compiler/tupleKinds.ts(8,45): error TS1109: Expression expected. +tests/cases/compiler/tupleKinds.ts(8,48): error TS2304: Cannot find name 'args'. +tests/cases/compiler/tupleKinds.ts(8,52): error TS1005: ';' expected. -==== tests/cases/compiler/tupleKinds.ts (1 errors) ==== - function tuple<...T>(...args:...T) { +==== tests/cases/compiler/tupleKinds.ts (13 errors) ==== + function tuple<...T>(...args:...T): ...T { ~~~~~~~~~~~~ !!! error TS2370: A rest parameter must be of an array type. return args; } + function noPredicates<...T>(...args): ...T is boolean { + ~~ +!!! error TS1144: '{' or ';' expected. + ~~ +!!! error TS2304: Cannot find name 'is'. + ~~~~~~~ +!!! error TS1005: ';' expected. + ~~~~~~~ +!!! error TS2304: Cannot find name 'boolean'. + ~ +!!! error TS1005: ';' expected. + } + function noArguments<...T, U>(...args): ...T { + ~ +!!! error TS1144: '{' or ';' expected. + ~ +!!! error TS2304: Cannot find name 'U'. + } + function noConstraints<...T extends string>(...args) { + ~~~~~~~ +!!! error TS1005: '>' expected. + ~~~~~~ +!!! error TS2304: Cannot find name 'string'. + ~~~ +!!! error TS1109: Expression expected. + ~~~~ +!!! error TS2304: Cannot find name 'args'. + ~ +!!! error TS1005: ';' expected. + } \ No newline at end of file diff --git a/tests/baselines/reference/tupleKinds.js b/tests/baselines/reference/tupleKinds.js index 5ffdc6c679f9f..a910e217ff26b 100644 --- a/tests/baselines/reference/tupleKinds.js +++ b/tests/baselines/reference/tupleKinds.js @@ -1,7 +1,13 @@ //// [tupleKinds.ts] -function tuple<...T>(...args:...T) { +function tuple<...T>(...args:...T): ...T { return args; } +function noPredicates<...T>(...args): ...T is boolean { +} +function noArguments<...T, U>(...args): ...T { +} +function noConstraints<...T extends string>(...args) { +} //// [tupleKinds.js] @@ -12,3 +18,12 @@ function tuple() { } return args; } +is; +boolean; +{ +} +{}; +string > (); +args; +{ +} diff --git a/tests/cases/compiler/tupleKinds.ts b/tests/cases/compiler/tupleKinds.ts index 3ac19ce169adb..c3e165fba424a 100644 --- a/tests/cases/compiler/tupleKinds.ts +++ b/tests/cases/compiler/tupleKinds.ts @@ -1,3 +1,9 @@ -function tuple<...T>(...args:...T) { +function tuple<...T>(...args:...T): ...T { return args; } +function noPredicates<...T>(...args): ...T is boolean { +} +function noArguments<...T, U>(...args): ...T { +} +function noConstraints<...T extends string>(...args) { +}