Skip to content

Commit ebd7d2d

Browse files
committed
extract method
1 parent a1cf51f commit ebd7d2d

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

src/harness/compilerRunner.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ class CompilerBaselineRunner extends RunnerBase {
4040
this.basePath += "/" + this.testSuiteName;
4141
}
4242

43+
private makeUnitName(name: string, root: string) {
44+
return ts.isRootedDiskPath(name) ? name : (root + name);
45+
};
46+
4347
public checkTestCodeOutput(fileName: string) {
4448
describe("compiler tests for " + fileName, () => {
4549
// Mocha holds onto the closure environment of the describe callback even after the test is done.
@@ -74,16 +78,16 @@ class CompilerBaselineRunner extends RunnerBase {
7478
toBeCompiled = [];
7579
otherFiles = [];
7680
if (/require\(/.test(lastUnit.content) || /reference\spath/.test(lastUnit.content)) {
77-
toBeCompiled.push({ unitName: ts.isRootedDiskPath(lastUnit.name) ? lastUnit.name : rootDir + lastUnit.name, content: lastUnit.content });
81+
toBeCompiled.push({ unitName: this.makeUnitName(lastUnit.name, rootDir), content: lastUnit.content });
7882
units.forEach(unit => {
7983
if (unit.name !== lastUnit.name) {
80-
otherFiles.push({ unitName: ts.isRootedDiskPath(unit.name) ? unit.name : rootDir + unit.name, content: unit.content });
84+
otherFiles.push({ unitName: this.makeUnitName(unit.name, rootDir), content: unit.content });
8185
}
8286
});
8387
}
8488
else {
8589
toBeCompiled = units.map(unit => {
86-
return { unitName: ts.isRootedDiskPath(unit.name) ? unit.name : rootDir + unit.name, content: unit.content };
90+
return { unitName: this.makeUnitName(unit.name, rootDir), content: unit.content };
8791
});
8892
}
8993

0 commit comments

Comments
 (0)