TypeScript/tests/cases/fourslash/referencesForUnionProperties.ts
Andy Hanson 8515f7e2b5 Change find-all-references tests to test for groups
* Also always test for isWriteAccess and isDefinition
2017-01-31 06:59:16 -08:00

38 lines
1.2 KiB
TypeScript

/// <reference path='fourslash.ts'/>
////interface One {
//// common: { [|{| "isWriteAccess": true, "isDefinition": true |}a|]: number; };
////}
////
////interface Base {
//// [|{| "isWriteAccess": true, "isDefinition": true |}a|]: string;
//// b: string;
////}
////
////interface HasAOrB extends Base {
//// [|{| "isWriteAccess": true, "isDefinition": true |}a|]: string;
//// b: string;
////}
////
////interface Two {
//// common: HasAOrB;
////}
////
////var x : One | Two;
////
////x.common.[|a|];
const [one, base, hasAOrB, x] = test.ranges();
verify.referenceGroups(one, [{ definition: "(property) a: number", ranges: [one, x] }]);
verify.referenceGroups(base, [{ definition: "(property) Base.a: string", ranges: [base, hasAOrB, x] }]);
verify.referenceGroups(hasAOrB, [
{ definition: "(property) Base.a: string", ranges: [base] },
{ definition: "(property) HasAOrB.a: string", ranges: [hasAOrB, x] }
]);
verify.referenceGroups(x, [
{ definition: "(property) a: number", ranges: [one] },
{ definition: "(property) Base.a: string", ranges: [base] },
{ definition: "(property) HasAOrB.a: string", ranges: [hasAOrB] },
{ definition: "(property) a: string | number", ranges: [x] }
]);