Add more coverage tests.

This commit is contained in:
Cyrus Najmabadi 2014-12-03 21:07:50 -08:00
parent 66c1b3df20
commit e6d1e39fb7
4 changed files with 19 additions and 10 deletions

View file

@ -1033,10 +1033,6 @@ module ts {
writer.writePunctuation(tokenToString(kind)); writer.writePunctuation(tokenToString(kind));
} }
function writeOperator(writer: SymbolWriter, kind: SyntaxKind) {
writer.writeOperator(tokenToString(kind));
}
function writeSpace(writer: SymbolWriter) { function writeSpace(writer: SymbolWriter) {
writer.writeSpace(" "); writer.writeSpace(" ");
} }
@ -7820,8 +7816,10 @@ module ts {
} }
function checkThrowStatement(node: ThrowStatement) { function checkThrowStatement(node: ThrowStatement) {
checkExpression(node.expression); if (node.expression) {
} checkExpression(node.expression);
}
}
function checkTryStatement(node: TryStatement) { function checkTryStatement(node: TryStatement) {
checkBlock(node.tryBlock); checkBlock(node.tryBlock);

View file

@ -27,6 +27,7 @@ var _chai: typeof chai = require('chai');
var assert: typeof _chai.assert = _chai.assert; var assert: typeof _chai.assert = _chai.assert;
declare var __dirname: any; // Node-specific declare var __dirname: any; // Node-specific
var global = <any>Function("return this").call(null); var global = <any>Function("return this").call(null);
var typescript = require('./typescriptServices');
module Utils { module Utils {
var global = <any>Function("return this").call(null); var global = <any>Function("return this").call(null);
@ -1389,7 +1390,4 @@ module Harness {
} }
if (Error) (<any>Error).stackTraceLimit = 1; if (Error) (<any>Error).stackTraceLimit = 1;
} }
// TODO: not sure why Utils.evalFile isn't working with this, eventually will concat it like old compiler instead of eval
eval(Harness.tcServicesFile);

View file

@ -0,0 +1,11 @@
tests/cases/compiler/throwWithoutNewLine2.ts(1,6): error TS1142: Line break not permitted here.
tests/cases/compiler/throwWithoutNewLine2.ts(2,1): error TS2304: Cannot find name 'a'.
==== tests/cases/compiler/throwWithoutNewLine2.ts (2 errors) ====
throw
!!! error TS1142: Line break not permitted here.
a;
~
!!! error TS2304: Cannot find name 'a'.

View file

@ -0,0 +1,2 @@
throw
a;