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
This commit is contained in:
Wesley Wigham
2017-08-18 11:44:36 -07:00
committed by GitHub
parent 487ba21c14
commit ecd2ae8dac

View File

@@ -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<true>();
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