Merge pull request #3049 from Microsoft/testPerf
Create "light" test-running mode and a '--noLibCheck' flag
This commit is contained in:
commit
46a842e19b
14
Jakefile.js
14
Jakefile.js
|
@ -505,9 +505,9 @@ function cleanTestDirs() {
|
||||||
}
|
}
|
||||||
|
|
||||||
// used to pass data from jake command line directly to run.js
|
// used to pass data from jake command line directly to run.js
|
||||||
function writeTestConfigFile(tests, testConfigFile) {
|
function writeTestConfigFile(tests, light, testConfigFile) {
|
||||||
console.log('Running test(s): ' + tests);
|
console.log('Running test(s): ' + tests);
|
||||||
var testConfigContents = JSON.stringify({ test: [tests]});
|
var testConfigContents = JSON.stringify({ test: [tests], light: light });
|
||||||
fs.writeFileSync('test.config', testConfigContents);
|
fs.writeFileSync('test.config', testConfigContents);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,13 +523,14 @@ task("runtests", ["tests", builtLocalDirectory], function() {
|
||||||
cleanTestDirs();
|
cleanTestDirs();
|
||||||
host = "mocha"
|
host = "mocha"
|
||||||
tests = process.env.test || process.env.tests || process.env.t;
|
tests = process.env.test || process.env.tests || process.env.t;
|
||||||
|
var light = process.env.light || false;
|
||||||
var testConfigFile = 'test.config';
|
var testConfigFile = 'test.config';
|
||||||
if(fs.existsSync(testConfigFile)) {
|
if(fs.existsSync(testConfigFile)) {
|
||||||
fs.unlinkSync(testConfigFile);
|
fs.unlinkSync(testConfigFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(tests) {
|
if(tests || light) {
|
||||||
writeTestConfigFile(tests, testConfigFile);
|
writeTestConfigFile(tests, light, testConfigFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tests && tests.toLocaleLowerCase() === "rwc") {
|
if (tests && tests.toLocaleLowerCase() === "rwc") {
|
||||||
|
@ -572,12 +573,13 @@ task("runtests-browser", ["tests", "browserify", builtLocalDirectory], function(
|
||||||
port = process.env.port || process.env.p || '8888';
|
port = process.env.port || process.env.p || '8888';
|
||||||
browser = process.env.browser || process.env.b || "IE";
|
browser = process.env.browser || process.env.b || "IE";
|
||||||
tests = process.env.test || process.env.tests || process.env.t;
|
tests = process.env.test || process.env.tests || process.env.t;
|
||||||
|
var light = process.env.light || false;
|
||||||
var testConfigFile = 'test.config';
|
var testConfigFile = 'test.config';
|
||||||
if(fs.existsSync(testConfigFile)) {
|
if(fs.existsSync(testConfigFile)) {
|
||||||
fs.unlinkSync(testConfigFile);
|
fs.unlinkSync(testConfigFile);
|
||||||
}
|
}
|
||||||
if(tests) {
|
if(tests || light) {
|
||||||
writeTestConfigFile(tests, testConfigFile);
|
writeTestConfigFile(tests, light, testConfigFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
tests = tests ? tests : '';
|
tests = tests ? tests : '';
|
||||||
|
|
|
@ -11609,7 +11609,9 @@ namespace ts {
|
||||||
|
|
||||||
function checkSourceFile(node: SourceFile) {
|
function checkSourceFile(node: SourceFile) {
|
||||||
let start = new Date().getTime();
|
let start = new Date().getTime();
|
||||||
|
|
||||||
checkSourceFileWorker(node);
|
checkSourceFileWorker(node);
|
||||||
|
|
||||||
checkTime += new Date().getTime() - start;
|
checkTime += new Date().getTime() - start;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -11617,6 +11619,8 @@ namespace ts {
|
||||||
function checkSourceFileWorker(node: SourceFile) {
|
function checkSourceFileWorker(node: SourceFile) {
|
||||||
let links = getNodeLinks(node);
|
let links = getNodeLinks(node);
|
||||||
if (!(links.flags & NodeCheckFlags.TypeChecked)) {
|
if (!(links.flags & NodeCheckFlags.TypeChecked)) {
|
||||||
|
// Check whether the file has declared it is the default lib,
|
||||||
|
// and whether the user has specifically chosen to avoid checking it.
|
||||||
if (node.isDefaultLib && compilerOptions.skipDefaultLibCheck) {
|
if (node.isDefaultLib && compilerOptions.skipDefaultLibCheck) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,21 +144,30 @@ namespace ts {
|
||||||
let program: Program;
|
let program: Program;
|
||||||
let files: SourceFile[] = [];
|
let files: SourceFile[] = [];
|
||||||
let diagnostics = createDiagnosticCollection();
|
let diagnostics = createDiagnosticCollection();
|
||||||
let skipDefaultLib = options.noLib;
|
|
||||||
let commonSourceDirectory: string;
|
let commonSourceDirectory: string;
|
||||||
let diagnosticsProducingTypeChecker: TypeChecker;
|
let diagnosticsProducingTypeChecker: TypeChecker;
|
||||||
let noDiagnosticsTypeChecker: TypeChecker;
|
let noDiagnosticsTypeChecker: TypeChecker;
|
||||||
let classifiableNames: Map<string>;
|
let classifiableNames: Map<string>;
|
||||||
|
|
||||||
|
let skipDefaultLib = options.noLib;
|
||||||
|
|
||||||
let start = new Date().getTime();
|
let start = new Date().getTime();
|
||||||
|
|
||||||
host = host || createCompilerHost(options);
|
host = host || createCompilerHost(options);
|
||||||
|
|
||||||
let filesByName = createFileMap<SourceFile>(fileName => host.getCanonicalFileName(fileName));
|
let filesByName = createFileMap<SourceFile>(fileName => host.getCanonicalFileName(fileName));
|
||||||
|
|
||||||
forEach(rootNames, name => processRootFile(name, /*isDefaultLib:*/ false));
|
forEach(rootNames, name => processRootFile(name, /*isDefaultLib:*/ false));
|
||||||
|
|
||||||
|
// Do not process the default library if:
|
||||||
|
// - The '--noLib' flag is used.
|
||||||
|
// - A 'no-default-lib' reference comment is encountered in
|
||||||
|
// processing the root files.
|
||||||
if (!skipDefaultLib) {
|
if (!skipDefaultLib) {
|
||||||
processRootFile(host.getDefaultLibFileName(options), /*isDefaultLib:*/ true);
|
processRootFile(host.getDefaultLibFileName(options), /*isDefaultLib:*/ true);
|
||||||
}
|
}
|
||||||
|
|
||||||
verifyCompilerOptions();
|
verifyCompilerOptions();
|
||||||
|
|
||||||
programTime += new Date().getTime() - start;
|
programTime += new Date().getTime() - start;
|
||||||
|
|
|
@ -1149,6 +1149,14 @@ namespace ts {
|
||||||
moduleName: string;
|
moduleName: string;
|
||||||
referencedFiles: FileReference[];
|
referencedFiles: FileReference[];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* lib.d.ts should have a reference comment like
|
||||||
|
*
|
||||||
|
* /// <reference no-default-lib="true"/>
|
||||||
|
*
|
||||||
|
* If any other file has this comment, it signals not to include lib.d.ts
|
||||||
|
* because this containing file is intended to act as a default library.
|
||||||
|
*/
|
||||||
hasNoDefaultLib: boolean;
|
hasNoDefaultLib: boolean;
|
||||||
|
|
||||||
languageVersion: ScriptTarget;
|
languageVersion: ScriptTarget;
|
||||||
|
@ -1860,7 +1868,10 @@ namespace ts {
|
||||||
experimentalDecorators?: boolean;
|
experimentalDecorators?: boolean;
|
||||||
emitDecoratorMetadata?: boolean;
|
emitDecoratorMetadata?: boolean;
|
||||||
/* @internal */ stripInternal?: boolean;
|
/* @internal */ stripInternal?: boolean;
|
||||||
|
|
||||||
|
// Skip checking lib.d.ts to help speed up tests.
|
||||||
/* @internal */ skipDefaultLibCheck?: boolean;
|
/* @internal */ skipDefaultLibCheck?: boolean;
|
||||||
|
|
||||||
[option: string]: string | number | boolean;
|
[option: string]: string | number | boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/// <reference path='harness.ts' />
|
/// <reference path='harness.ts' />
|
||||||
/// <reference path='runnerbase.ts' />
|
/// <reference path='runnerbase.ts' />
|
||||||
/// <reference path='typeWriter.ts' />
|
/// <reference path='typeWriter.ts' />
|
||||||
/// <reference path='syntacticCleaner.ts' />
|
|
||||||
|
|
||||||
const enum CompilerTestType {
|
const enum CompilerTestType {
|
||||||
Conformance,
|
Conformance,
|
||||||
|
@ -18,7 +17,7 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||||
|
|
||||||
public options: string;
|
public options: string;
|
||||||
|
|
||||||
constructor(public testType?: CompilerTestType) {
|
constructor(public testType: CompilerTestType) {
|
||||||
super();
|
super();
|
||||||
this.errors = true;
|
this.errors = true;
|
||||||
this.emit = true;
|
this.emit = true;
|
||||||
|
@ -171,7 +170,6 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it('Correct JS output for ' + fileName, () => {
|
it('Correct JS output for ' + fileName, () => {
|
||||||
if (!ts.fileExtensionIs(lastUnit.name, '.d.ts') && this.emit) {
|
if (!ts.fileExtensionIs(lastUnit.name, '.d.ts') && this.emit) {
|
||||||
if (result.files.length === 0 && result.errors.length === 0) {
|
if (result.files.length === 0 && result.errors.length === 0) {
|
||||||
|
@ -195,8 +193,6 @@ class CompilerBaselineRunner extends RunnerBase {
|
||||||
jsCode += '//// [' + Harness.Path.getFileName(result.files[i].fileName) + ']\r\n';
|
jsCode += '//// [' + Harness.Path.getFileName(result.files[i].fileName) + ']\r\n';
|
||||||
jsCode += getByteOrderMarkText(result.files[i]);
|
jsCode += getByteOrderMarkText(result.files[i]);
|
||||||
jsCode += result.files[i].code;
|
jsCode += result.files[i].code;
|
||||||
// Re-enable this if we want to do another comparison of old vs new compiler baselines
|
|
||||||
// jsCode += SyntacticCleaner.clean(result.files[i].code);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.declFilesCode.length > 0) {
|
if (result.declFilesCode.length > 0) {
|
||||||
|
|
|
@ -1,74 +0,0 @@
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
//
|
|
||||||
|
|
||||||
// Allows for executing a program with command-line arguments and reading the result
|
|
||||||
interface IExec {
|
|
||||||
exec: (fileName: string, cmdLineArgs: string[], handleResult: (ExecResult: ExecResult) => void) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ExecResult {
|
|
||||||
public stdout = "";
|
|
||||||
public stderr = "";
|
|
||||||
public exitCode: number;
|
|
||||||
}
|
|
||||||
|
|
||||||
class WindowsScriptHostExec implements IExec {
|
|
||||||
public exec(fileName: string, cmdLineArgs: string[], handleResult: (ExecResult: ExecResult) => void) : void {
|
|
||||||
var result = new ExecResult();
|
|
||||||
var shell = new ActiveXObject('WScript.Shell');
|
|
||||||
try {
|
|
||||||
var process = shell.Exec(fileName + ' ' + cmdLineArgs.join(' '));
|
|
||||||
} catch(e) {
|
|
||||||
result.stderr = e.message;
|
|
||||||
result.exitCode = 1;
|
|
||||||
handleResult(result);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
// Wait for it to finish running
|
|
||||||
while (process.Status != 0) { /* todo: sleep? */ }
|
|
||||||
|
|
||||||
|
|
||||||
result.exitCode = process.ExitCode;
|
|
||||||
if(!process.StdOut.AtEndOfStream) result.stdout = process.StdOut.ReadAll();
|
|
||||||
if(!process.StdErr.AtEndOfStream) result.stderr = process.StdErr.ReadAll();
|
|
||||||
|
|
||||||
handleResult(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
class NodeExec implements IExec {
|
|
||||||
public exec(fileName: string, cmdLineArgs: string[], handleResult: (ExecResult: ExecResult) => void) : void {
|
|
||||||
var nodeExec = require('child_process').exec;
|
|
||||||
|
|
||||||
var result = new ExecResult();
|
|
||||||
result.exitCode = null;
|
|
||||||
var cmdLine = fileName + ' ' + cmdLineArgs.join(' ');
|
|
||||||
var process = nodeExec(cmdLine, function(error: any, stdout: string, stderr: string) {
|
|
||||||
result.stdout = stdout;
|
|
||||||
result.stderr = stderr;
|
|
||||||
result.exitCode = error ? error.code : 0;
|
|
||||||
handleResult(result);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var Exec: IExec = function() : IExec {
|
|
||||||
var global = <any>Function("return this;").call(null);
|
|
||||||
if(typeof global.ActiveXObject !== "undefined") {
|
|
||||||
return new WindowsScriptHostExec();
|
|
||||||
} else {
|
|
||||||
return new NodeExec();
|
|
||||||
}
|
|
||||||
}();
|
|
|
@ -343,7 +343,8 @@ module FourSlash {
|
||||||
if (!resolvedResult.isLibFile) {
|
if (!resolvedResult.isLibFile) {
|
||||||
this.languageServiceAdapterHost.addScript(Harness.Compiler.defaultLibFileName, Harness.Compiler.defaultLibSourceFile.text);
|
this.languageServiceAdapterHost.addScript(Harness.Compiler.defaultLibFileName, Harness.Compiler.defaultLibSourceFile.text);
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
// resolveReference file-option is not specified then do not resolve any files and include all inputFiles
|
// resolveReference file-option is not specified then do not resolve any files and include all inputFiles
|
||||||
ts.forEachKey(this.inputFiles, fileName => {
|
ts.forEachKey(this.inputFiles, fileName => {
|
||||||
if (!Harness.isLibraryFile(fileName)) {
|
if (!Harness.isLibraryFile(fileName)) {
|
||||||
|
|
|
@ -99,7 +99,7 @@ module Utils {
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var content = ts.sys.readFile(Harness.userSpecifiedroot + path);
|
var content = ts.sys.readFile(Harness.userSpecifiedRoot + path);
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
@ -732,7 +732,8 @@ module Harness {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Settings
|
// Settings
|
||||||
export var userSpecifiedroot = "";
|
export let userSpecifiedRoot = "";
|
||||||
|
export let lightMode = false;
|
||||||
|
|
||||||
/** Functionality for compiling TypeScript code */
|
/** Functionality for compiling TypeScript code */
|
||||||
export module Compiler {
|
export module Compiler {
|
||||||
|
@ -809,17 +810,19 @@ module Harness {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function createSourceFileAndAssertInvariants(
|
export function createSourceFileAndAssertInvariants(
|
||||||
fileName: string,
|
fileName: string,
|
||||||
sourceText: string,
|
sourceText: string,
|
||||||
languageVersion: ts.ScriptTarget,
|
languageVersion: ts.ScriptTarget) {
|
||||||
assertInvariants: boolean) {
|
// We'll only assert invariants outside of light mode.
|
||||||
|
const shouldAssertInvariants = !Harness.lightMode;
|
||||||
|
|
||||||
// Only set the parent nodes if we're asserting invariants. We don't need them otherwise.
|
// Only set the parent nodes if we're asserting invariants. We don't need them otherwise.
|
||||||
var result = ts.createSourceFile(fileName, sourceText, languageVersion, /*setParentNodes:*/ assertInvariants);
|
var result = ts.createSourceFile(fileName, sourceText, languageVersion, /*setParentNodes:*/ shouldAssertInvariants);
|
||||||
|
|
||||||
if (assertInvariants) {
|
if (shouldAssertInvariants) {
|
||||||
Utils.assertInvariants(result, /*parent:*/ undefined);
|
Utils.assertInvariants(result, /*parent:*/ undefined);
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -827,8 +830,8 @@ module Harness {
|
||||||
const lineFeed = "\n";
|
const lineFeed = "\n";
|
||||||
|
|
||||||
export var defaultLibFileName = 'lib.d.ts';
|
export var defaultLibFileName = 'lib.d.ts';
|
||||||
export var defaultLibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + 'lib.core.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest, /*assertInvariants:*/ true);
|
export var defaultLibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + 'lib.core.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest);
|
||||||
export var defaultES6LibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + 'lib.core.es6.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest, /*assertInvariants:*/ true);
|
export var defaultES6LibSourceFile = createSourceFileAndAssertInvariants(defaultLibFileName, IO.readFile(libFolder + 'lib.core.es6.d.ts'), /*languageVersion*/ ts.ScriptTarget.Latest);
|
||||||
|
|
||||||
// Cache these between executions so we don't have to re-parse them for every test
|
// Cache these between executions so we don't have to re-parse them for every test
|
||||||
export var fourslashFileName = 'fourslash.ts';
|
export var fourslashFileName = 'fourslash.ts';
|
||||||
|
@ -859,7 +862,7 @@ module Harness {
|
||||||
function register(file: { unitName: string; content: string; }) {
|
function register(file: { unitName: string; content: string; }) {
|
||||||
if (file.content !== undefined) {
|
if (file.content !== undefined) {
|
||||||
var fileName = ts.normalizePath(file.unitName);
|
var fileName = ts.normalizePath(file.unitName);
|
||||||
filemap[getCanonicalFileName(fileName)] = createSourceFileAndAssertInvariants(fileName, file.content, scriptTarget, /*assertInvariants:*/ true);
|
filemap[getCanonicalFileName(fileName)] = createSourceFileAndAssertInvariants(fileName, file.content, scriptTarget);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
inputFiles.forEach(register);
|
inputFiles.forEach(register);
|
||||||
|
@ -882,7 +885,7 @@ module Harness {
|
||||||
}
|
}
|
||||||
else if (fn === fourslashFileName) {
|
else if (fn === fourslashFileName) {
|
||||||
var tsFn = 'tests/cases/fourslash/' + fourslashFileName;
|
var tsFn = 'tests/cases/fourslash/' + fourslashFileName;
|
||||||
fourslashSourceFile = fourslashSourceFile || createSourceFileAndAssertInvariants(tsFn, Harness.IO.readFile(tsFn), scriptTarget, /*assertInvariants:*/ true);
|
fourslashSourceFile = fourslashSourceFile || createSourceFileAndAssertInvariants(tsFn, Harness.IO.readFile(tsFn), scriptTarget);
|
||||||
return fourslashSourceFile;
|
return fourslashSourceFile;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -939,17 +942,19 @@ module Harness {
|
||||||
}
|
}
|
||||||
|
|
||||||
public emitAll(ioHost?: IEmitterIOHost) {
|
public emitAll(ioHost?: IEmitterIOHost) {
|
||||||
this.compileFiles(this.inputFiles, [],(result) => {
|
this.compileFiles(this.inputFiles,
|
||||||
result.files.forEach(file => {
|
/*otherFiles*/ [],
|
||||||
ioHost.writeFile(file.fileName, file.code, false);
|
/*onComplete*/ result => {
|
||||||
});
|
result.files.forEach(writeFile);
|
||||||
result.declFilesCode.forEach(file => {
|
result.declFilesCode.forEach(writeFile);
|
||||||
ioHost.writeFile(file.fileName, file.code, false);
|
result.sourceMaps.forEach(writeFile);
|
||||||
});
|
},
|
||||||
result.sourceMaps.forEach(file => {
|
/*settingsCallback*/ () => { },
|
||||||
ioHost.writeFile(file.fileName, file.code, false);
|
this.compileOptions);
|
||||||
});
|
|
||||||
},() => { }, this.compileOptions);
|
function writeFile(file: GeneratedFile) {
|
||||||
|
ioHost.writeFile(file.fileName, file.code, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public compileFiles(inputFiles: { unitName: string; content: string }[],
|
public compileFiles(inputFiles: { unitName: string; content: string }[],
|
||||||
|
@ -958,8 +963,7 @@ module Harness {
|
||||||
settingsCallback?: (settings: ts.CompilerOptions) => void,
|
settingsCallback?: (settings: ts.CompilerOptions) => void,
|
||||||
options?: ts.CompilerOptions,
|
options?: ts.CompilerOptions,
|
||||||
// Current directory is needed for rwcRunner to be able to use currentDirectory defined in json file
|
// Current directory is needed for rwcRunner to be able to use currentDirectory defined in json file
|
||||||
currentDirectory?: string,
|
currentDirectory?: string) {
|
||||||
assertInvariants = true) {
|
|
||||||
|
|
||||||
options = options || { noResolve: false };
|
options = options || { noResolve: false };
|
||||||
options.target = options.target || ts.ScriptTarget.ES3;
|
options.target = options.target || ts.ScriptTarget.ES3;
|
||||||
|
@ -979,7 +983,31 @@ module Harness {
|
||||||
var includeBuiltFiles: { unitName: string; content: string }[] = [];
|
var includeBuiltFiles: { unitName: string; content: string }[] = [];
|
||||||
|
|
||||||
var useCaseSensitiveFileNames = ts.sys.useCaseSensitiveFileNames;
|
var useCaseSensitiveFileNames = ts.sys.useCaseSensitiveFileNames;
|
||||||
this.settings.forEach(setting => {
|
this.settings.forEach(setCompilerOptionForSetting);
|
||||||
|
|
||||||
|
var fileOutputs: GeneratedFile[] = [];
|
||||||
|
|
||||||
|
var programFiles = inputFiles.concat(includeBuiltFiles).map(file => file.unitName);
|
||||||
|
|
||||||
|
var compilerHost = createCompilerHost(
|
||||||
|
inputFiles.concat(includeBuiltFiles).concat(otherFiles),
|
||||||
|
(fn, contents, writeByteOrderMark) => fileOutputs.push({ fileName: fn, code: contents, writeByteOrderMark: writeByteOrderMark }),
|
||||||
|
options.target, useCaseSensitiveFileNames, currentDirectory, options.newLine);
|
||||||
|
var program = ts.createProgram(programFiles, options, compilerHost);
|
||||||
|
|
||||||
|
var emitResult = program.emit();
|
||||||
|
|
||||||
|
var errors = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
||||||
|
this.lastErrors = errors;
|
||||||
|
|
||||||
|
var result = new CompilerResult(fileOutputs, errors, program, ts.sys.getCurrentDirectory(), emitResult.sourceMaps);
|
||||||
|
onComplete(result, program);
|
||||||
|
|
||||||
|
// reset what newline means in case the last test changed it
|
||||||
|
ts.sys.newLine = newLine;
|
||||||
|
return options;
|
||||||
|
|
||||||
|
function setCompilerOptionForSetting(setting: Harness.TestCaseParser.CompilerSetting) {
|
||||||
switch (setting.flag.toLowerCase()) {
|
switch (setting.flag.toLowerCase()) {
|
||||||
// "fileName", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noimplicitany", "noresolve"
|
// "fileName", "comments", "declaration", "module", "nolib", "sourcemap", "target", "out", "outdir", "noimplicitany", "noresolve"
|
||||||
case "module":
|
case "module":
|
||||||
|
@ -1133,7 +1161,7 @@ module Harness {
|
||||||
case 'inlinesourcemap':
|
case 'inlinesourcemap':
|
||||||
options.inlineSourceMap = setting.value === 'true';
|
options.inlineSourceMap = setting.value === 'true';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'inlinesources':
|
case 'inlinesources':
|
||||||
options.inlineSources = setting.value === 'true';
|
options.inlineSources = setting.value === 'true';
|
||||||
break;
|
break;
|
||||||
|
@ -1141,28 +1169,7 @@ module Harness {
|
||||||
default:
|
default:
|
||||||
throw new Error('Unsupported compiler setting ' + setting.flag);
|
throw new Error('Unsupported compiler setting ' + setting.flag);
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
var fileOutputs: GeneratedFile[] = [];
|
|
||||||
|
|
||||||
var programFiles = inputFiles.concat(includeBuiltFiles).map(file => file.unitName);
|
|
||||||
var compilerHost = createCompilerHost(
|
|
||||||
inputFiles.concat(includeBuiltFiles).concat(otherFiles),
|
|
||||||
(fn, contents, writeByteOrderMark) => fileOutputs.push({ fileName: fn, code: contents, writeByteOrderMark: writeByteOrderMark }),
|
|
||||||
options.target, useCaseSensitiveFileNames, currentDirectory, options.newLine);
|
|
||||||
var program = ts.createProgram(programFiles, options, compilerHost);
|
|
||||||
|
|
||||||
var emitResult = program.emit();
|
|
||||||
|
|
||||||
var errors = ts.getPreEmitDiagnostics(program).concat(emitResult.diagnostics);
|
|
||||||
this.lastErrors = errors;
|
|
||||||
|
|
||||||
var result = new CompilerResult(fileOutputs, errors, program, ts.sys.getCurrentDirectory(), emitResult.sourceMaps);
|
|
||||||
onComplete(result, program);
|
|
||||||
|
|
||||||
// reset what newline means in case the last test changed it
|
|
||||||
ts.sys.newLine = newLine;
|
|
||||||
return options;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public compileDeclarationFiles(inputFiles: { unitName: string; content: string; }[],
|
public compileDeclarationFiles(inputFiles: { unitName: string; content: string; }[],
|
||||||
|
@ -1363,29 +1370,30 @@ module Harness {
|
||||||
ts.sys.newLine + ts.sys.newLine + outputLines.join('\r\n');
|
ts.sys.newLine + ts.sys.newLine + outputLines.join('\r\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
export function collateOutputs(outputFiles: Harness.Compiler.GeneratedFile[], clean?: (s: string) => string) {
|
export function collateOutputs(outputFiles: Harness.Compiler.GeneratedFile[]): string {
|
||||||
// Collect, test, and sort the fileNames
|
// Collect, test, and sort the fileNames
|
||||||
function cleanName(fn: string) {
|
|
||||||
var lastSlash = ts.normalizeSlashes(fn).lastIndexOf('/');
|
|
||||||
return fn.substr(lastSlash + 1).toLowerCase();
|
|
||||||
}
|
|
||||||
outputFiles.sort((a, b) => cleanName(a.fileName).localeCompare(cleanName(b.fileName)));
|
outputFiles.sort((a, b) => cleanName(a.fileName).localeCompare(cleanName(b.fileName)));
|
||||||
|
|
||||||
// Emit them
|
// Emit them
|
||||||
var result = '';
|
var result = '';
|
||||||
ts.forEach(outputFiles, outputFile => {
|
for (let outputFile of outputFiles) {
|
||||||
// Some extra spacing if this isn't the first file
|
// Some extra spacing if this isn't the first file
|
||||||
if (result.length) result = result + '\r\n\r\n';
|
if (result.length) {
|
||||||
|
result += '\r\n\r\n';
|
||||||
|
}
|
||||||
|
|
||||||
// FileName header + content
|
// FileName header + content
|
||||||
result = result + '/*====== ' + outputFile.fileName + ' ======*/\r\n';
|
result += '/*====== ' + outputFile.fileName + ' ======*/\r\n';
|
||||||
if (clean) {
|
|
||||||
result = result + clean(outputFile.code);
|
result += outputFile.code;
|
||||||
} else {
|
}
|
||||||
result = result + outputFile.code;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
function cleanName(fn: string) {
|
||||||
|
var lastSlash = ts.normalizeSlashes(fn).lastIndexOf('/');
|
||||||
|
return fn.substr(lastSlash + 1).toLowerCase();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** The harness' compiler instance used when tests are actually run. Reseting or changing settings of this compiler instance must be done within a test case (i.e., describe/it) */
|
/** The harness' compiler instance used when tests are actually run. Reseting or changing settings of this compiler instance must be done within a test case (i.e., describe/it) */
|
||||||
|
@ -1487,16 +1495,6 @@ module Harness {
|
||||||
// Regex for parsing options in the format "@Alpha: Value of any sort"
|
// Regex for parsing options in the format "@Alpha: Value of any sort"
|
||||||
var optionRegex = /^[\/]{2}\s*@(\w+)\s*:\s*(\S*)/gm; // multiple matches on multiple lines
|
var optionRegex = /^[\/]{2}\s*@(\w+)\s*:\s*(\S*)/gm; // multiple matches on multiple lines
|
||||||
|
|
||||||
// List of allowed metadata names
|
|
||||||
var fileMetadataNames = ["filename", "comments", "declaration", "module",
|
|
||||||
"nolib", "sourcemap", "target", "out", "outdir", "noemithelpers", "noemitonerror",
|
|
||||||
"noimplicitany", "noresolve", "newline", "normalizenewline", "emitbom",
|
|
||||||
"errortruncation", "usecasesensitivefilenames", "preserveconstenums",
|
|
||||||
"includebuiltfile", "suppressimplicitanyindexerrors", "stripinternal",
|
|
||||||
"isolatedmodules", "inlinesourcemap", "maproot", "sourceroot",
|
|
||||||
"inlinesources", "emitdecoratormetadata", "experimentaldecorators",
|
|
||||||
"skipdefaultlibcheck"];
|
|
||||||
|
|
||||||
function extractCompilerSettings(content: string): CompilerSetting[] {
|
function extractCompilerSettings(content: string): CompilerSetting[] {
|
||||||
|
|
||||||
var opts: CompilerSetting[] = [];
|
var opts: CompilerSetting[] = [];
|
||||||
|
@ -1530,10 +1528,8 @@ module Harness {
|
||||||
if (testMetaData) {
|
if (testMetaData) {
|
||||||
// Comment line, check for global/file @options and record them
|
// Comment line, check for global/file @options and record them
|
||||||
optionRegex.lastIndex = 0;
|
optionRegex.lastIndex = 0;
|
||||||
var fileNameIndex = fileMetadataNames.indexOf(testMetaData[1].toLowerCase());
|
var metaDataName = testMetaData[1].toLowerCase();
|
||||||
if (fileNameIndex === -1) {
|
if (metaDataName === "filename") {
|
||||||
throw new Error('Unrecognized metadata name "' + testMetaData[1] + '". Available file metadata names are: ' + fileMetadataNames.join(', '));
|
|
||||||
} else if (fileNameIndex === 0) {
|
|
||||||
currentFileOptions[testMetaData[1]] = testMetaData[2];
|
currentFileOptions[testMetaData[1]] = testMetaData[2];
|
||||||
} else {
|
} else {
|
||||||
continue;
|
continue;
|
||||||
|
@ -1619,9 +1615,9 @@ module Harness {
|
||||||
|
|
||||||
function baselinePath(fileName: string, type: string, baselineFolder: string, subfolder?: string) {
|
function baselinePath(fileName: string, type: string, baselineFolder: string, subfolder?: string) {
|
||||||
if (subfolder !== undefined) {
|
if (subfolder !== undefined) {
|
||||||
return Harness.userSpecifiedroot + baselineFolder + '/' + subfolder + '/' + type + '/' + fileName;
|
return Harness.userSpecifiedRoot + baselineFolder + '/' + subfolder + '/' + type + '/' + fileName;
|
||||||
} else {
|
} else {
|
||||||
return Harness.userSpecifiedroot + baselineFolder + '/' + type + '/' + fileName;
|
return Harness.userSpecifiedRoot + baselineFolder + '/' + type + '/' + fileName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1730,7 +1726,7 @@ module Harness {
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDefaultLibraryFile(): { unitName: string, content: string } {
|
export function getDefaultLibraryFile(): { unitName: string, content: string } {
|
||||||
var libFile = Harness.userSpecifiedroot + Harness.libFolder + "/" + "lib.d.ts";
|
var libFile = Harness.userSpecifiedRoot + Harness.libFolder + "/" + "lib.d.ts";
|
||||||
return {
|
return {
|
||||||
unitName: libFile,
|
unitName: libFile,
|
||||||
content: IO.readFile(libFile)
|
content: IO.readFile(libFile)
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
//
|
|
||||||
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
||||||
//
|
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
// you may not use this file except in compliance with the License.
|
|
||||||
// You may obtain a copy of the License at
|
|
||||||
// http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
//
|
|
||||||
// Unless required by applicable law or agreed to in writing, software
|
|
||||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
// See the License for the specific language governing permissions and
|
|
||||||
// limitations under the License.
|
|
||||||
//
|
|
||||||
|
|
||||||
/// <reference path="exec.ts" />
|
|
||||||
/// <reference path="generate.ts" />
|
|
||||||
/// <reference path="harness.ts" />
|
|
||||||
/// <reference path="diff.ts" />
|
|
|
@ -174,7 +174,7 @@ class ProjectRunner extends RunnerBase {
|
||||||
else {
|
else {
|
||||||
var text = getSourceFileText(fileName);
|
var text = getSourceFileText(fileName);
|
||||||
if (text !== undefined) {
|
if (text !== undefined) {
|
||||||
sourceFile = Harness.Compiler.createSourceFileAndAssertInvariants(fileName, text, languageVersion, /*assertInvariants:*/ true);
|
sourceFile = Harness.Compiler.createSourceFileAndAssertInvariants(fileName, text, languageVersion);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
/// <reference path='fourslashRunner.ts' />
|
/// <reference path='fourslashRunner.ts' />
|
||||||
/// <reference path='projectsRunner.ts' />
|
/// <reference path='projectsRunner.ts' />
|
||||||
/// <reference path='rwcRunner.ts' />
|
/// <reference path='rwcRunner.ts' />
|
||||||
|
/// <reference path='harness.ts' />
|
||||||
|
|
||||||
function runTests(runners: RunnerBase[]) {
|
function runTests(runners: RunnerBase[]) {
|
||||||
for (var i = iterations; i > 0; i--) {
|
for (var i = iterations; i > 0; i--) {
|
||||||
|
@ -39,6 +40,9 @@ var testConfigFile =
|
||||||
|
|
||||||
if (testConfigFile !== '') {
|
if (testConfigFile !== '') {
|
||||||
var testConfig = JSON.parse(testConfigFile);
|
var testConfig = JSON.parse(testConfigFile);
|
||||||
|
if (testConfig.light) {
|
||||||
|
Harness.lightMode = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (testConfig.test && testConfig.test.length > 0) {
|
if (testConfig.test && testConfig.test.length > 0) {
|
||||||
for (let option of testConfig.test) {
|
for (let option of testConfig.test) {
|
||||||
|
|
|
@ -12,7 +12,7 @@ class RunnerBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
public enumerateFiles(folder: string, regex?: RegExp, options?: { recursive: boolean }): string[] {
|
public enumerateFiles(folder: string, regex?: RegExp, options?: { recursive: boolean }): string[] {
|
||||||
return Harness.IO.listFiles(Harness.userSpecifiedroot + folder, regex, { recursive: (options ? options.recursive : false) });
|
return Harness.IO.listFiles(Harness.userSpecifiedRoot + folder, regex, { recursive: (options ? options.recursive : false) });
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Setup the runner's tests so that they are ready to be executed by the harness
|
/** Setup the runner's tests so that they are ready to be executed by the harness
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/// <reference path='harness.ts'/>
|
/// <reference path='harness.ts'/>
|
||||||
/// <reference path='runnerbase.ts' />
|
/// <reference path='runnerbase.ts' />
|
||||||
/// <reference path='syntacticCleaner.ts' />
|
|
||||||
/// <reference path='loggedIO.ts' />
|
/// <reference path='loggedIO.ts' />
|
||||||
/// <reference path='..\compiler\commandLineParser.ts'/>
|
/// <reference path='..\compiler\commandLineParser.ts'/>
|
||||||
|
|
||||||
|
@ -75,7 +74,7 @@ module RWC {
|
||||||
});
|
});
|
||||||
|
|
||||||
// Add files to compilation
|
// Add files to compilation
|
||||||
for(let fileRead of ioLog.filesRead) {
|
for (let fileRead of ioLog.filesRead) {
|
||||||
// Check if the file is already added into the set of input files.
|
// Check if the file is already added into the set of input files.
|
||||||
var resolvedPath = ts.normalizeSlashes(ts.sys.resolvePath(fileRead.path));
|
var resolvedPath = ts.normalizeSlashes(ts.sys.resolvePath(fileRead.path));
|
||||||
var inInputList = ts.forEach(inputFiles, inputFile => inputFile.unitName === resolvedPath);
|
var inInputList = ts.forEach(inputFiles, inputFile => inputFile.unitName === resolvedPath);
|
||||||
|
@ -107,14 +106,14 @@ module RWC {
|
||||||
opts.options.noLib = true;
|
opts.options.noLib = true;
|
||||||
|
|
||||||
// Emit the results
|
// Emit the results
|
||||||
compilerOptions = harnessCompiler.compileFiles(inputFiles, otherFiles, compileResult => {
|
compilerOptions = harnessCompiler.compileFiles(
|
||||||
compilerResult = compileResult;
|
inputFiles,
|
||||||
},
|
otherFiles,
|
||||||
|
newCompilerResults => { compilerResult = newCompilerResults; },
|
||||||
/*settingsCallback*/ undefined, opts.options,
|
/*settingsCallback*/ undefined, opts.options,
|
||||||
// Since all Rwc json file specified current directory in its json file, we need to pass this information to compilerHost
|
// Since each RWC json file specifies its current directory in its json file, we need
|
||||||
// so that when the host is asked for current directory, it should give the value from json rather than from process
|
// to pass this information in explicitly instead of acquiring it from the process.
|
||||||
currentDirectory,
|
currentDirectory);
|
||||||
/*assertInvariants:*/ false);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
function getHarnessCompilerInputUnit(fileName: string) {
|
function getHarnessCompilerInputUnit(fileName: string) {
|
||||||
|
@ -132,7 +131,7 @@ module RWC {
|
||||||
|
|
||||||
it('has the expected emitted code', () => {
|
it('has the expected emitted code', () => {
|
||||||
Harness.Baseline.runBaseline('has the expected emitted code', baseName + '.output.js', () => {
|
Harness.Baseline.runBaseline('has the expected emitted code', baseName + '.output.js', () => {
|
||||||
return Harness.Compiler.collateOutputs(compilerResult.files, s => SyntacticCleaner.clean(s));
|
return Harness.Compiler.collateOutputs(compilerResult.files);
|
||||||
}, false, baselineOpts);
|
}, false, baselineOpts);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
// Use this to get emitter-agnostic baselines
|
|
||||||
|
|
||||||
class SyntacticCleaner {
|
|
||||||
static clean(sourceFileContents: string) {
|
|
||||||
return sourceFileContents;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* TODO: Re-implement or maybe delete
|
|
||||||
class SyntacticCleaner extends TypeScript.SyntaxWalker {
|
|
||||||
private emit: string[] = [];
|
|
||||||
|
|
||||||
public visitToken(token: TypeScript.ISyntaxToken): void {
|
|
||||||
this.emit.push(token.text());
|
|
||||||
if (token.kind() === TypeScript.SyntaxKind.SemicolonToken) {
|
|
||||||
this.emit.push('\r\n');
|
|
||||||
} else {
|
|
||||||
this.emit.push(' ');
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static clean(sourceFileContents: string): string {
|
|
||||||
var parsed = TypeScript.Parser.parse('_emitted.ts', TypeScript.SimpleText.fromString(sourceFileContents), TypeScript.LanguageVersion.EcmaScript5, false);
|
|
||||||
var cleaner = new SyntacticCleaner();
|
|
||||||
cleaner.visitSourceUnit(parsed.sourceUnit());
|
|
||||||
return cleaner.emit.join('');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
*/
|
|
|
@ -1,6 +1,5 @@
|
||||||
/// <reference path='harness.ts' />
|
/// <reference path='harness.ts' />
|
||||||
/// <reference path='runnerbase.ts' />
|
/// <reference path='runnerbase.ts' />
|
||||||
/// <reference path='syntacticCleaner.ts' />
|
|
||||||
|
|
||||||
class Test262BaselineRunner extends RunnerBase {
|
class Test262BaselineRunner extends RunnerBase {
|
||||||
private static basePath = 'internal/cases/test262';
|
private static basePath = 'internal/cases/test262';
|
||||||
|
@ -65,7 +64,7 @@ class Test262BaselineRunner extends RunnerBase {
|
||||||
it('has the expected emitted code', () => {
|
it('has the expected emitted code', () => {
|
||||||
Harness.Baseline.runBaseline('has the expected emitted code', testState.filename + '.output.js', () => {
|
Harness.Baseline.runBaseline('has the expected emitted code', testState.filename + '.output.js', () => {
|
||||||
var files = testState.compilerResult.files.filter(f=> f.fileName !== Test262BaselineRunner.helpersFilePath);
|
var files = testState.compilerResult.files.filter(f=> f.fileName !== Test262BaselineRunner.helpersFilePath);
|
||||||
return Harness.Compiler.collateOutputs(files, s => SyntacticCleaner.clean(s));
|
return Harness.Compiler.collateOutputs(files);
|
||||||
}, false, Test262BaselineRunner.baselineOptions);
|
}, false, Test262BaselineRunner.baselineOptions);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,6 @@ error TS2318: Cannot find global type 'String'.
|
||||||
!!! error TS2318: Cannot find global type 'String'.
|
!!! error TS2318: Cannot find global type 'String'.
|
||||||
==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509698.ts (0 errors) ====
|
==== tests/cases/conformance/parser/ecmascript5/RegressionTests/parser509698.ts (0 errors) ====
|
||||||
/// <style requireSemi="on" />
|
/// <style requireSemi="on" />
|
||||||
/// <reference no-default-lib="true"/>
|
|
||||||
declare function foo(): void;
|
declare function foo(): void;
|
||||||
declare function bar(): void;
|
declare function bar(): void;
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
//// [parser509698.ts]
|
//// [parser509698.ts]
|
||||||
/// <style requireSemi="on" />
|
/// <style requireSemi="on" />
|
||||||
/// <reference no-default-lib="true"/>
|
|
||||||
declare function foo(): void;
|
declare function foo(): void;
|
||||||
declare function bar(): void;
|
declare function bar(): void;
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
|
// @noLib: true
|
||||||
/// <style requireSemi="on" />
|
/// <style requireSemi="on" />
|
||||||
/// <reference no-default-lib="true"/>
|
|
||||||
declare function foo(): void;
|
declare function foo(): void;
|
||||||
declare function bar(): void;
|
declare function bar(): void;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/// <reference path="..\..\..\src\harness\harness.ts" />
|
/// <reference path="..\..\..\src\harness\harness.ts" />
|
||||||
|
|
||||||
module ts {
|
module ts {
|
||||||
describe('convertToBase64', () => {
|
describe('convertToBase64', () => {
|
||||||
|
@ -8,25 +8,25 @@ module ts {
|
||||||
assert.equal(actual, expected, "Encoded string using convertToBase64 does not match buffer.toString('base64')");
|
assert.equal(actual, expected, "Encoded string using convertToBase64 does not match buffer.toString('base64')");
|
||||||
}
|
}
|
||||||
|
|
||||||
it("Converts ASCII charaters correctelly", () => {
|
it("Converts ASCII charaters correctly", () => {
|
||||||
runTest(" !\"#$ %&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~");
|
runTest(" !\"#$ %&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Converts escape sequences correctelly", () => {
|
it("Converts escape sequences correctly", () => {
|
||||||
runTest("\t\n\r\\\"\'\u0062");
|
runTest("\t\n\r\\\"\'\u0062");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Converts simple unicode characters correctelly", () => {
|
it("Converts simple unicode characters correctly", () => {
|
||||||
runTest("ΠΣ ٵپ औठ ⺐⺠");
|
runTest("ΠΣ ٵپ औठ ⺐⺠");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Converts simple code snippit correctelly", () => {
|
it("Converts simple code snippet correctly", () => {
|
||||||
runTest(`/// <reference path="file.ts" />
|
runTest(`/// <reference path="file.ts" />
|
||||||
var x: string = "string";
|
var x: string = "string";
|
||||||
console.log(x);`);
|
console.log(x);`);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("Converts simple code snippit with unicode characters correctelly", () => {
|
it("Converts simple code snippet with unicode characters correctly", () => {
|
||||||
runTest(`var Π = 3.1415; console.log(Π);`);
|
runTest(`var Π = 3.1415; console.log(Π);`);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/// <reference path="..\..\..\src\harness\harness.ts" />
|
/// <reference path="..\..\..\src\harness\harness.ts" />
|
||||||
|
|
||||||
module ts {
|
module ts {
|
||||||
describe("Transpile", () => {
|
describe("Transpile", () => {
|
||||||
|
|
Loading…
Reference in a new issue