Move RWC runner to use Harness.IO

This commit is contained in:
Vladimir Matveev
2015-08-26 18:54:25 -07:00
parent 1d94653798
commit af2a49992f
4 changed files with 60 additions and 33 deletions

View File

@@ -237,13 +237,13 @@ namespace ts {
}
];
export function parseCommandLine(commandLine: string[]): ParsedCommandLine {
export function parseCommandLine(commandLine: string[], readFile?: (fileName: string) => string): ParsedCommandLine {
let options: CompilerOptions = {};
let fileNames: string[] = [];
let errors: Diagnostic[] = [];
let shortOptionNames: Map<string> = {};
let optionNameMap: Map<CommandLineOption> = {};
forEach(optionDeclarations, option => {
optionNameMap[option.name.toLowerCase()] = option;
if (option.shortName) {
@@ -313,7 +313,7 @@ namespace ts {
}
function parseResponseFile(fileName: string) {
let text = sys.readFile(fileName);
let text = readFile ? readFile(fileName): sys.readFile(fileName);
if (!text) {
errors.push(createCompilerDiagnostic(Diagnostics.File_0_not_found, fileName));