From ecd2ae8dac34ab8cc9f41d054824b1fc9cfa73ff Mon Sep 17 00:00:00 2001 From: Wesley Wigham Date: Fri, 18 Aug 2017 11:44:36 -0700 Subject: [PATCH] Deduplicate inputfiles before running RWC tests (#17877) * Deduplicate inputfiles before running RWC tests We deduplicate in the compiler, but we don't in the harness - this causes tests where the same file is listed multiple times in the arguments to not have the expected errors written, because we write out the same file multiple times when we should not. * Don't completely omit both copied of duplicates * Remove trailing whitespace * Maintain list order while filtering duplicates * Merge adjacent loops --- src/harness/rwcRunner.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/harness/rwcRunner.ts b/src/harness/rwcRunner.ts index a1dc50349e4..cddb9b19d4a 100644 --- a/src/harness/rwcRunner.ts +++ b/src/harness/rwcRunner.ts @@ -90,9 +90,16 @@ namespace RWC { ts.setConfigFileInOptions(opts.options, configParseResult.options.configFile); } - // Load the files + // Deduplicate files so they are only printed once in baselines (they are deduplicated within the compiler already) + const uniqueNames = ts.createMap(); for (const fileName of fileNames) { - inputFiles.push(getHarnessCompilerInputUnit(fileName)); + // Must maintain order, build result list while checking map + const normalized = ts.normalizeSlashes(fileName); + if (!uniqueNames.has(normalized)) { + uniqueNames.set(normalized, true); + // Load the file + inputFiles.push(getHarnessCompilerInputUnit(fileName)); + } } // Add files to compilation