Skip to content

Forbid duplicates in baselines #44652

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/testRunner/runner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,26 @@ namespace Harness {

function runTests(runners: RunnerBase[]) {
for (let i = iterations; i > 0; i--) {
const seen = new Map<string, string>();
const dupes: [string, string][] = [];
for (const runner of runners) {
for (const sf of runner.enumerateTestFiles()) {
const full = typeof sf === "string" ? sf : sf.file;
const base = vpath.basename(full).toLowerCase();
// exempt fourslash-fourslash conflicts since they're less likely to emit baselines
if (seen.has(base) && !(/fourslash/.test(seen.get(base)!) && /fourslash/.test(full))) {
dupes.push([seen.get(base)!, full]);
}
else {
seen.set(base, full);
}
}
runner.initializeTests();
}
if (dupes.length) {
throw new Error(`${dupes.length} Tests with duplicate baseline names:
${JSON.stringify(dupes, undefined, 2)}`);
}
}
}

Expand Down
59 changes: 0 additions & 59 deletions tests/baselines/reference/abstractProperty.symbols

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//// [abstractProperty.ts]
//// [abstractPropertyBasics.ts]
interface A {
prop: string;
raw: string;
Expand All @@ -21,7 +21,7 @@ class C extends B {
m() { }
}

//// [abstractProperty.js]
//// [abstractPropertyBasics.js]
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
Expand Down
59 changes: 59 additions & 0 deletions tests/baselines/reference/abstractPropertyBasics.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
=== tests/cases/compiler/abstractPropertyBasics.ts ===
interface A {
>A : Symbol(A, Decl(abstractPropertyBasics.ts, 0, 0))

prop: string;
>prop : Symbol(A.prop, Decl(abstractPropertyBasics.ts, 0, 13))

raw: string;
>raw : Symbol(A.raw, Decl(abstractPropertyBasics.ts, 1, 17))

m(): void;
>m : Symbol(A.m, Decl(abstractPropertyBasics.ts, 2, 16))
}
abstract class B implements A {
>B : Symbol(B, Decl(abstractPropertyBasics.ts, 4, 1))
>A : Symbol(A, Decl(abstractPropertyBasics.ts, 0, 0))

abstract prop: string;
>prop : Symbol(B.prop, Decl(abstractPropertyBasics.ts, 5, 31))

abstract raw: string;
>raw : Symbol(B.raw, Decl(abstractPropertyBasics.ts, 6, 26))

abstract readonly ro: string;
>ro : Symbol(B.ro, Decl(abstractPropertyBasics.ts, 7, 25))

abstract get readonlyProp(): string;
>readonlyProp : Symbol(B.readonlyProp, Decl(abstractPropertyBasics.ts, 8, 33), Decl(abstractPropertyBasics.ts, 9, 40))

abstract set readonlyProp(val: string);
>readonlyProp : Symbol(B.readonlyProp, Decl(abstractPropertyBasics.ts, 8, 33), Decl(abstractPropertyBasics.ts, 9, 40))
>val : Symbol(val, Decl(abstractPropertyBasics.ts, 10, 30))

abstract m(): void;
>m : Symbol(B.m, Decl(abstractPropertyBasics.ts, 10, 43))
}
class C extends B {
>C : Symbol(C, Decl(abstractPropertyBasics.ts, 12, 1))
>B : Symbol(B, Decl(abstractPropertyBasics.ts, 4, 1))

get prop() { return "foo"; }
>prop : Symbol(C.prop, Decl(abstractPropertyBasics.ts, 13, 19), Decl(abstractPropertyBasics.ts, 14, 32))

set prop(v) { }
>prop : Symbol(C.prop, Decl(abstractPropertyBasics.ts, 13, 19), Decl(abstractPropertyBasics.ts, 14, 32))
>v : Symbol(v, Decl(abstractPropertyBasics.ts, 15, 13))

raw = "edge";
>raw : Symbol(C.raw, Decl(abstractPropertyBasics.ts, 15, 19))

readonly ro = "readonly please";
>ro : Symbol(C.ro, Decl(abstractPropertyBasics.ts, 16, 17))

readonlyProp: string; // don't have to give a value, in fact
>readonlyProp : Symbol(C.readonlyProp, Decl(abstractPropertyBasics.ts, 17, 36))

m() { }
>m : Symbol(C.m, Decl(abstractPropertyBasics.ts, 18, 25))
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
=== tests/cases/compiler/abstractProperty.ts ===
=== tests/cases/compiler/abstractPropertyBasics.ts ===
interface A {
prop: string;
>prop : string
Expand Down
File renamed without changes.