From 66c1b3df20987f0463bb279d3d70433c16d27f41 Mon Sep 17 00:00:00 2001 From: Cyrus Najmabadi Date: Wed, 3 Dec 2014 20:41:39 -0800 Subject: [PATCH] Add grammar walker test coverage cases. --- .../reference/accessorWithoutBody1.errors.txt | 7 +++++++ .../reference/accessorWithoutBody2.errors.txt | 7 +++++++ ...callExpressionWithMissingTypeArgument1.errors.txt | 10 ++++++++++ .../reference/declareModifierOnImport1.errors.txt | 10 ++++++++++ .../indexSignatureWithInitializer1.errors.txt | 12 ++++++++++++ .../indexSignatureWithoutTypeAnnotation1..js | 4 ++++ .../indexSignatureWithoutTypeAnnotation1..types | 3 +++ .../indexSignatureWithoutTypeAnnotation1.errors.txt | 9 +++++++++ .../reference/modifierOnParameter1.errors.txt | 9 +++++++++ .../reference/throwWithoutNewLine1.errors.txt | 7 +++++++ .../reference/typeParameterListWithTrailingComma1.js | 10 ++++++++++ .../typeParameterListWithTrailingComma1.types | 5 +++++ .../variableDeclarationInStrictMode1.errors.txt | 12 ++++++++++++ .../baselines/reference/yieldExpression1.errors.txt | 9 +++++++++ tests/cases/compiler/accessorWithoutBody1.ts | 2 ++ tests/cases/compiler/accessorWithoutBody2.ts | 2 ++ .../callExpressionWithMissingTypeArgument1.ts | 1 + tests/cases/compiler/declareModifierOnImport1.ts | 1 + .../cases/compiler/indexSignatureWithInitializer1.ts | 3 +++ .../indexSignatureWithoutTypeAnnotation1..ts | 0 .../compiler/indexSignatureWithoutTypeAnnotation1.ts | 3 +++ tests/cases/compiler/modifierOnParameter1.ts | 3 +++ tests/cases/compiler/throwWithoutNewLine1.ts | 1 + .../compiler/typeParameterListWithTrailingComma1.ts | 2 ++ .../compiler/variableDeclarationInStrictMode1.ts | 2 ++ tests/cases/compiler/yieldExpression1.ts | 3 +++ 26 files changed, 137 insertions(+) create mode 100644 tests/baselines/reference/accessorWithoutBody1.errors.txt create mode 100644 tests/baselines/reference/accessorWithoutBody2.errors.txt create mode 100644 tests/baselines/reference/callExpressionWithMissingTypeArgument1.errors.txt create mode 100644 tests/baselines/reference/declareModifierOnImport1.errors.txt create mode 100644 tests/baselines/reference/indexSignatureWithInitializer1.errors.txt create mode 100644 tests/baselines/reference/indexSignatureWithoutTypeAnnotation1..js create mode 100644 tests/baselines/reference/indexSignatureWithoutTypeAnnotation1..types create mode 100644 tests/baselines/reference/indexSignatureWithoutTypeAnnotation1.errors.txt create mode 100644 tests/baselines/reference/modifierOnParameter1.errors.txt create mode 100644 tests/baselines/reference/throwWithoutNewLine1.errors.txt create mode 100644 tests/baselines/reference/typeParameterListWithTrailingComma1.js create mode 100644 tests/baselines/reference/typeParameterListWithTrailingComma1.types create mode 100644 tests/baselines/reference/variableDeclarationInStrictMode1.errors.txt create mode 100644 tests/baselines/reference/yieldExpression1.errors.txt create mode 100644 tests/cases/compiler/accessorWithoutBody1.ts create mode 100644 tests/cases/compiler/accessorWithoutBody2.ts create mode 100644 tests/cases/compiler/callExpressionWithMissingTypeArgument1.ts create mode 100644 tests/cases/compiler/declareModifierOnImport1.ts create mode 100644 tests/cases/compiler/indexSignatureWithInitializer1.ts create mode 100644 tests/cases/compiler/indexSignatureWithoutTypeAnnotation1..ts create mode 100644 tests/cases/compiler/indexSignatureWithoutTypeAnnotation1.ts create mode 100644 tests/cases/compiler/modifierOnParameter1.ts create mode 100644 tests/cases/compiler/throwWithoutNewLine1.ts create mode 100644 tests/cases/compiler/typeParameterListWithTrailingComma1.ts create mode 100644 tests/cases/compiler/variableDeclarationInStrictMode1.ts create mode 100644 tests/cases/compiler/yieldExpression1.ts diff --git a/tests/baselines/reference/accessorWithoutBody1.errors.txt b/tests/baselines/reference/accessorWithoutBody1.errors.txt new file mode 100644 index 0000000000..3d074abf25 --- /dev/null +++ b/tests/baselines/reference/accessorWithoutBody1.errors.txt @@ -0,0 +1,7 @@ +tests/cases/compiler/accessorWithoutBody1.ts(1,19): error TS1005: '{' expected. + + +==== tests/cases/compiler/accessorWithoutBody1.ts (1 errors) ==== + var v = { get foo() } + ~ +!!! error TS1005: '{' expected. \ No newline at end of file diff --git a/tests/baselines/reference/accessorWithoutBody2.errors.txt b/tests/baselines/reference/accessorWithoutBody2.errors.txt new file mode 100644 index 0000000000..41bec93904 --- /dev/null +++ b/tests/baselines/reference/accessorWithoutBody2.errors.txt @@ -0,0 +1,7 @@ +tests/cases/compiler/accessorWithoutBody2.ts(1,20): error TS1005: '{' expected. + + +==== tests/cases/compiler/accessorWithoutBody2.ts (1 errors) ==== + var v = { set foo(a) } + ~ +!!! error TS1005: '{' expected. \ No newline at end of file diff --git a/tests/baselines/reference/callExpressionWithMissingTypeArgument1.errors.txt b/tests/baselines/reference/callExpressionWithMissingTypeArgument1.errors.txt new file mode 100644 index 0000000000..7d91abeaa6 --- /dev/null +++ b/tests/baselines/reference/callExpressionWithMissingTypeArgument1.errors.txt @@ -0,0 +1,10 @@ +tests/cases/compiler/callExpressionWithMissingTypeArgument1.ts(1,7): error TS1110: Type expected. +tests/cases/compiler/callExpressionWithMissingTypeArgument1.ts(1,1): error TS2304: Cannot find name 'Foo'. + + +==== tests/cases/compiler/callExpressionWithMissingTypeArgument1.ts (2 errors) ==== + Foo(); + +!!! error TS1110: Type expected. + ~~~ +!!! error TS2304: Cannot find name 'Foo'. \ No newline at end of file diff --git a/tests/baselines/reference/declareModifierOnImport1.errors.txt b/tests/baselines/reference/declareModifierOnImport1.errors.txt new file mode 100644 index 0000000000..e78b4973aa --- /dev/null +++ b/tests/baselines/reference/declareModifierOnImport1.errors.txt @@ -0,0 +1,10 @@ +tests/cases/compiler/declareModifierOnImport1.ts(1,1): error TS1079: A 'declare' modifier cannot be used with an import declaration. +tests/cases/compiler/declareModifierOnImport1.ts(1,1): error TS2304: Cannot find name 'b'. + + +==== tests/cases/compiler/declareModifierOnImport1.ts (2 errors) ==== + declare import a = b; + ~~~~~~~ +!!! error TS1079: A 'declare' modifier cannot be used with an import declaration. + ~~~~~~~~~~~~~~~~~~~~~ +!!! error TS2304: Cannot find name 'b'. \ No newline at end of file diff --git a/tests/baselines/reference/indexSignatureWithInitializer1.errors.txt b/tests/baselines/reference/indexSignatureWithInitializer1.errors.txt new file mode 100644 index 0000000000..899cbd5dda --- /dev/null +++ b/tests/baselines/reference/indexSignatureWithInitializer1.errors.txt @@ -0,0 +1,12 @@ +tests/cases/compiler/indexSignatureWithInitializer1.ts(2,4): error TS1020: An index signature parameter cannot have an initializer. +tests/cases/compiler/indexSignatureWithInitializer1.ts(2,4): error TS2371: A parameter initializer is only allowed in a function or constructor implementation. + + +==== tests/cases/compiler/indexSignatureWithInitializer1.ts (2 errors) ==== + class C { + [a: number = 1]: number; + ~ +!!! error TS1020: An index signature parameter cannot have an initializer. + ~~~~~~~~~~~~~ +!!! error TS2371: A parameter initializer is only allowed in a function or constructor implementation. + } \ No newline at end of file diff --git a/tests/baselines/reference/indexSignatureWithoutTypeAnnotation1..js b/tests/baselines/reference/indexSignatureWithoutTypeAnnotation1..js new file mode 100644 index 0000000000..e500cfc221 --- /dev/null +++ b/tests/baselines/reference/indexSignatureWithoutTypeAnnotation1..js @@ -0,0 +1,4 @@ +//// [indexSignatureWithoutTypeAnnotation1..ts] + + +//// [indexSignatureWithoutTypeAnnotation1..js] diff --git a/tests/baselines/reference/indexSignatureWithoutTypeAnnotation1..types b/tests/baselines/reference/indexSignatureWithoutTypeAnnotation1..types new file mode 100644 index 0000000000..7ab1bd72cd --- /dev/null +++ b/tests/baselines/reference/indexSignatureWithoutTypeAnnotation1..types @@ -0,0 +1,3 @@ +=== tests/cases/compiler/indexSignatureWithoutTypeAnnotation1..ts === + +No type information for this code. \ No newline at end of file diff --git a/tests/baselines/reference/indexSignatureWithoutTypeAnnotation1.errors.txt b/tests/baselines/reference/indexSignatureWithoutTypeAnnotation1.errors.txt new file mode 100644 index 0000000000..5562005a0b --- /dev/null +++ b/tests/baselines/reference/indexSignatureWithoutTypeAnnotation1.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/indexSignatureWithoutTypeAnnotation1.ts(2,3): error TS1021: An index signature must have a type annotation. + + +==== tests/cases/compiler/indexSignatureWithoutTypeAnnotation1.ts (1 errors) ==== + class C { + [a: number]; + ~~~~~~~~~~~~ +!!! error TS1021: An index signature must have a type annotation. + } \ No newline at end of file diff --git a/tests/baselines/reference/modifierOnParameter1.errors.txt b/tests/baselines/reference/modifierOnParameter1.errors.txt new file mode 100644 index 0000000000..72ec2aab93 --- /dev/null +++ b/tests/baselines/reference/modifierOnParameter1.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/modifierOnParameter1.ts(2,16): error TS1090: 'declare' modifier cannot appear on a parameter. + + +==== tests/cases/compiler/modifierOnParameter1.ts (1 errors) ==== + class C { + constructor(declare p) { } + ~~~~~~~ +!!! error TS1090: 'declare' modifier cannot appear on a parameter. + } \ No newline at end of file diff --git a/tests/baselines/reference/throwWithoutNewLine1.errors.txt b/tests/baselines/reference/throwWithoutNewLine1.errors.txt new file mode 100644 index 0000000000..6cc1c8f6fc --- /dev/null +++ b/tests/baselines/reference/throwWithoutNewLine1.errors.txt @@ -0,0 +1,7 @@ +tests/cases/compiler/throwWithoutNewLine1.ts(1,6): error TS1109: Expression expected. + + +==== tests/cases/compiler/throwWithoutNewLine1.ts (1 errors) ==== + throw + +!!! error TS1109: Expression expected. \ No newline at end of file diff --git a/tests/baselines/reference/typeParameterListWithTrailingComma1.js b/tests/baselines/reference/typeParameterListWithTrailingComma1.js new file mode 100644 index 0000000000..3891310fcb --- /dev/null +++ b/tests/baselines/reference/typeParameterListWithTrailingComma1.js @@ -0,0 +1,10 @@ +//// [typeParameterListWithTrailingComma1.ts] +class C { +} + +//// [typeParameterListWithTrailingComma1.js] +var C = (function () { + function C() { + } + return C; +})(); diff --git a/tests/baselines/reference/typeParameterListWithTrailingComma1.types b/tests/baselines/reference/typeParameterListWithTrailingComma1.types new file mode 100644 index 0000000000..9c68a7ac30 --- /dev/null +++ b/tests/baselines/reference/typeParameterListWithTrailingComma1.types @@ -0,0 +1,5 @@ +=== tests/cases/compiler/typeParameterListWithTrailingComma1.ts === +class C { +>C : C +>T : T +} diff --git a/tests/baselines/reference/variableDeclarationInStrictMode1.errors.txt b/tests/baselines/reference/variableDeclarationInStrictMode1.errors.txt new file mode 100644 index 0000000000..aa2ccdbed9 --- /dev/null +++ b/tests/baselines/reference/variableDeclarationInStrictMode1.errors.txt @@ -0,0 +1,12 @@ +tests/cases/compiler/variableDeclarationInStrictMode1.ts(2,5): error TS1100: Invalid use of 'eval' in strict mode. +lib.d.ts(29,18): error TS2300: Duplicate identifier 'eval'. +tests/cases/compiler/variableDeclarationInStrictMode1.ts(2,5): error TS2300: Duplicate identifier 'eval'. + + +==== tests/cases/compiler/variableDeclarationInStrictMode1.ts (2 errors) ==== + "use strict"; + var eval; + ~~~~ +!!! error TS1100: Invalid use of 'eval' in strict mode. + ~~~~ +!!! error TS2300: Duplicate identifier 'eval'. \ No newline at end of file diff --git a/tests/baselines/reference/yieldExpression1.errors.txt b/tests/baselines/reference/yieldExpression1.errors.txt new file mode 100644 index 0000000000..ecac77698c --- /dev/null +++ b/tests/baselines/reference/yieldExpression1.errors.txt @@ -0,0 +1,9 @@ +tests/cases/compiler/yieldExpression1.ts(1,9): error TS9001: 'generators' are not currently supported. + + +==== tests/cases/compiler/yieldExpression1.ts (1 errors) ==== + function* foo() { + ~ +!!! error TS9001: 'generators' are not currently supported. + yield + } \ No newline at end of file diff --git a/tests/cases/compiler/accessorWithoutBody1.ts b/tests/cases/compiler/accessorWithoutBody1.ts new file mode 100644 index 0000000000..2cf246affb --- /dev/null +++ b/tests/cases/compiler/accessorWithoutBody1.ts @@ -0,0 +1,2 @@ +// @target: ES5 +var v = { get foo() } \ No newline at end of file diff --git a/tests/cases/compiler/accessorWithoutBody2.ts b/tests/cases/compiler/accessorWithoutBody2.ts new file mode 100644 index 0000000000..11ece4b4d9 --- /dev/null +++ b/tests/cases/compiler/accessorWithoutBody2.ts @@ -0,0 +1,2 @@ +// @target: ES5 +var v = { set foo(a) } \ No newline at end of file diff --git a/tests/cases/compiler/callExpressionWithMissingTypeArgument1.ts b/tests/cases/compiler/callExpressionWithMissingTypeArgument1.ts new file mode 100644 index 0000000000..ea118fc4d4 --- /dev/null +++ b/tests/cases/compiler/callExpressionWithMissingTypeArgument1.ts @@ -0,0 +1 @@ +Foo(); \ No newline at end of file diff --git a/tests/cases/compiler/declareModifierOnImport1.ts b/tests/cases/compiler/declareModifierOnImport1.ts new file mode 100644 index 0000000000..8ccd192479 --- /dev/null +++ b/tests/cases/compiler/declareModifierOnImport1.ts @@ -0,0 +1 @@ +declare import a = b; \ No newline at end of file diff --git a/tests/cases/compiler/indexSignatureWithInitializer1.ts b/tests/cases/compiler/indexSignatureWithInitializer1.ts new file mode 100644 index 0000000000..d60fb81f0a --- /dev/null +++ b/tests/cases/compiler/indexSignatureWithInitializer1.ts @@ -0,0 +1,3 @@ +class C { + [a: number = 1]: number; +} \ No newline at end of file diff --git a/tests/cases/compiler/indexSignatureWithoutTypeAnnotation1..ts b/tests/cases/compiler/indexSignatureWithoutTypeAnnotation1..ts new file mode 100644 index 0000000000..e69de29bb2 diff --git a/tests/cases/compiler/indexSignatureWithoutTypeAnnotation1.ts b/tests/cases/compiler/indexSignatureWithoutTypeAnnotation1.ts new file mode 100644 index 0000000000..0bd92d4416 --- /dev/null +++ b/tests/cases/compiler/indexSignatureWithoutTypeAnnotation1.ts @@ -0,0 +1,3 @@ +class C { + [a: number]; +} \ No newline at end of file diff --git a/tests/cases/compiler/modifierOnParameter1.ts b/tests/cases/compiler/modifierOnParameter1.ts new file mode 100644 index 0000000000..931911af9b --- /dev/null +++ b/tests/cases/compiler/modifierOnParameter1.ts @@ -0,0 +1,3 @@ +class C { + constructor(declare p) { } +} \ No newline at end of file diff --git a/tests/cases/compiler/throwWithoutNewLine1.ts b/tests/cases/compiler/throwWithoutNewLine1.ts new file mode 100644 index 0000000000..755c8ff384 --- /dev/null +++ b/tests/cases/compiler/throwWithoutNewLine1.ts @@ -0,0 +1 @@ +throw \ No newline at end of file diff --git a/tests/cases/compiler/typeParameterListWithTrailingComma1.ts b/tests/cases/compiler/typeParameterListWithTrailingComma1.ts new file mode 100644 index 0000000000..68a11982cb --- /dev/null +++ b/tests/cases/compiler/typeParameterListWithTrailingComma1.ts @@ -0,0 +1,2 @@ +class C { +} \ No newline at end of file diff --git a/tests/cases/compiler/variableDeclarationInStrictMode1.ts b/tests/cases/compiler/variableDeclarationInStrictMode1.ts new file mode 100644 index 0000000000..266e5af44a --- /dev/null +++ b/tests/cases/compiler/variableDeclarationInStrictMode1.ts @@ -0,0 +1,2 @@ +"use strict"; +var eval; \ No newline at end of file diff --git a/tests/cases/compiler/yieldExpression1.ts b/tests/cases/compiler/yieldExpression1.ts new file mode 100644 index 0000000000..15c950f724 --- /dev/null +++ b/tests/cases/compiler/yieldExpression1.ts @@ -0,0 +1,3 @@ +function* foo() { + yield +} \ No newline at end of file