Skip to content

Commit e295948

Browse files
test: Strip prefix from relationship symbol names (#307)
Forgot to modify one place in the snapshot formatting logic in the previous PR.
1 parent c22c95c commit e295948

File tree

6 files changed

+37
-37
lines changed

6 files changed

+37
-37
lines changed

snapshots/output/syntax/src/conflicting-const-interface.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export interface ConflictingConst {}
66
// ^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`conflicting-const-interface.ts`/ConflictingConst#
77
export class ImplementsConflictingConst implements ConflictingConst {}
88
// ^^^^^^^^^^^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`conflicting-const-interface.ts`/ImplementsConflictingConst#
9-
// relationship implementation scip-typescript npm syntax 1.0.0 src/`conflicting-const-interface.ts`/ConflictingConst#
9+
// relationship implementation syntax 1.0.0 src/`conflicting-const-interface.ts`/ConflictingConst#
1010
// ^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`conflicting-const-interface.ts`/ConflictingConst.
1111
// ^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`conflicting-const-interface.ts`/ConflictingConst#
1212

snapshots/output/syntax/src/destructuring.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const props: Props = { a: 42 }
99
// ^^^^^ definition syntax 1.0.0 src/`destructuring.ts`/props.
1010
// ^^^^^ reference syntax 1.0.0 src/`destructuring.ts`/Props#
1111
// ^ definition syntax 1.0.0 src/`destructuring.ts`/a0:
12-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`destructuring.ts`/Props#a.
12+
// relationship implementation reference syntax 1.0.0 src/`destructuring.ts`/Props#a.
1313

1414
export function objectDestructuring(): number[] {
1515
// ^^^^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`destructuring.ts`/objectDestructuring().

snapshots/output/syntax/src/infer-relationship.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function returnStatement(): Configuration {
2323
return {
2424
property: 41,
2525
// ^^^^^^^^ definition syntax 1.0.0 src/`infer-relationship.ts`/property0:
26-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`infer-relationship.ts`/Configuration#property.
26+
// relationship implementation reference syntax 1.0.0 src/`infer-relationship.ts`/Configuration#property.
2727
}
2828
}
2929
for (let i = 0; i < 9; i++) {
@@ -36,7 +36,7 @@ export function returnStatement(): Configuration {
3636
return {
3737
property: 41,
3838
// ^^^^^^^^ definition syntax 1.0.0 src/`infer-relationship.ts`/property1:
39-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`infer-relationship.ts`/Configuration#property.
39+
// relationship implementation reference syntax 1.0.0 src/`infer-relationship.ts`/Configuration#property.
4040
}
4141
}
4242
}
@@ -48,7 +48,7 @@ export function returnStatement(): Configuration {
4848
return {
4949
property: 41,
5050
// ^^^^^^^^ definition syntax 1.0.0 src/`infer-relationship.ts`/property2:
51-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`infer-relationship.ts`/Configuration#property.
51+
// relationship implementation reference syntax 1.0.0 src/`infer-relationship.ts`/Configuration#property.
5252
}
5353
}
5454
}
@@ -66,7 +66,7 @@ export function returnStatement(): Configuration {
6666
return {
6767
property: 41,
6868
// ^^^^^^^^ definition syntax 1.0.0 src/`infer-relationship.ts`/property3:
69-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`infer-relationship.ts`/Configuration#property.
69+
// relationship implementation reference syntax 1.0.0 src/`infer-relationship.ts`/Configuration#property.
7070
}
7171
}
7272
}
@@ -75,7 +75,7 @@ export function returnStatement(): Configuration {
7575
return {
7676
property: 41,
7777
// ^^^^^^^^ definition syntax 1.0.0 src/`infer-relationship.ts`/property4:
78-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`infer-relationship.ts`/Configuration#property.
78+
// relationship implementation reference syntax 1.0.0 src/`infer-relationship.ts`/Configuration#property.
7979
}
8080
}
8181
do {
@@ -84,7 +84,7 @@ export function returnStatement(): Configuration {
8484
return {
8585
property: 41,
8686
// ^^^^^^^^ definition syntax 1.0.0 src/`infer-relationship.ts`/property5:
87-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`infer-relationship.ts`/Configuration#property.
87+
// relationship implementation reference syntax 1.0.0 src/`infer-relationship.ts`/Configuration#property.
8888
}
8989
}
9090
} while (random() < 0)
@@ -93,7 +93,7 @@ export function returnStatement(): Configuration {
9393
return {
9494
property: 42,
9595
// ^^^^^^^^ definition syntax 1.0.0 src/`infer-relationship.ts`/property6:
96-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`infer-relationship.ts`/Configuration#property.
96+
// relationship implementation reference syntax 1.0.0 src/`infer-relationship.ts`/Configuration#property.
9797
}
9898
}
9999

snapshots/output/syntax/src/inheritance.ts

+18-18
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,23 @@ export abstract class Superclass {
2424
}
2525
export abstract class IntermediateSuperclass extends Superclass {
2626
// ^^^^^^^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperclass#
27-
// relationship implementation scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/Superclass#
27+
// relationship implementation syntax 1.0.0 src/`inheritance.ts`/Superclass#
2828
// ^^^^^^^^^^ reference syntax 1.0.0 src/`inheritance.ts`/Superclass#
2929
public override overrideMethod(): string {
3030
// ^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperclass#overrideMethod().
31-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/Superclass#overrideMethod().
31+
// relationship implementation reference syntax 1.0.0 src/`inheritance.ts`/Superclass#overrideMethod().
3232
return 'this will get overridden'
3333
}
3434
public abstract intermediateOverrideMethod(): string
3535
// ^^^^^^^^^^^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperclass#intermediateOverrideMethod().
3636
}
3737
export class Subclass
3838
// ^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Subclass#
39-
// relationship implementation scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperclass#
40-
// relationship implementation scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperinterface#
41-
// relationship implementation scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/Superclass#
42-
// relationship implementation scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/Superinterface#
43-
// relationship implementation scip-typescript npm syntax 1.0.0 src/`overload.d.ts`/Overloader#
39+
// relationship implementation syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperclass#
40+
// relationship implementation syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperinterface#
41+
// relationship implementation syntax 1.0.0 src/`inheritance.ts`/Superclass#
42+
// relationship implementation syntax 1.0.0 src/`inheritance.ts`/Superinterface#
43+
// relationship implementation syntax 1.0.0 src/`overload.d.ts`/Overloader#
4444
extends IntermediateSuperclass
4545
// ^^^^^^^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperclass#
4646
implements IntermediateSuperinterface, Overloader
@@ -49,7 +49,7 @@ export class Subclass
4949
{
5050
public onLiteral(param: any): void {
5151
// ^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Subclass#onLiteral().
52-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`overload.d.ts`/Overloader#onLiteral().
52+
// relationship implementation reference syntax 1.0.0 src/`overload.d.ts`/Overloader#onLiteral().
5353
// ^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Subclass#onLiteral().(param)
5454
throw new Error('Method not implemented.' + param)
5555
// ^^^^^ reference typescript 5.3.3 lib/`lib.es5.d.ts`/Error#
@@ -58,32 +58,32 @@ export class Subclass
5858
}
5959
property = 'property'
6060
//^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Subclass#property.
61-
//relationship implementation reference scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/Superinterface#property.
61+
//relationship implementation reference syntax 1.0.0 src/`inheritance.ts`/Superinterface#property.
6262
public overrideMethod(): string {
6363
// ^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Subclass#overrideMethod().
64-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperclass#overrideMethod().
65-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/Superclass#overrideMethod().
64+
// relationship implementation reference syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperclass#overrideMethod().
65+
// relationship implementation reference syntax 1.0.0 src/`inheritance.ts`/Superclass#overrideMethod().
6666
throw new Error('Method not implemented.')
6767
// ^^^^^ reference typescript 5.3.3 lib/`lib.es5.d.ts`/Error#
6868
// ^^^^^ reference typescript 5.3.3 lib/`lib.es5.d.ts`/Error.
6969
}
7070
public intermediateOverrideMethod(): string {
7171
// ^^^^^^^^^^^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Subclass#intermediateOverrideMethod().
72-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperclass#intermediateOverrideMethod().
72+
// relationship implementation reference syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperclass#intermediateOverrideMethod().
7373
throw new Error('Method not implemented.')
7474
// ^^^^^ reference typescript 5.3.3 lib/`lib.es5.d.ts`/Error#
7575
// ^^^^^ reference typescript 5.3.3 lib/`lib.es5.d.ts`/Error.
7676
}
7777
public interfaceMethod(): string {
7878
// ^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Subclass#interfaceMethod().
79-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/Superinterface#interfaceMethod().
79+
// relationship implementation reference syntax 1.0.0 src/`inheritance.ts`/Superinterface#interfaceMethod().
8080
throw new Error('Method not implemented.')
8181
// ^^^^^ reference typescript 5.3.3 lib/`lib.es5.d.ts`/Error#
8282
// ^^^^^ reference typescript 5.3.3 lib/`lib.es5.d.ts`/Error.
8383
}
8484
public intermediateInterfaceMethod(): string {
8585
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/Subclass#intermediateInterfaceMethod().
86-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperinterface#intermediateInterfaceMethod().
86+
// relationship implementation reference syntax 1.0.0 src/`inheritance.ts`/IntermediateSuperinterface#intermediateInterfaceMethod().
8787
throw new Error('Method not implemented.')
8888
// ^^^^^ reference typescript 5.3.3 lib/`lib.es5.d.ts`/Error#
8989
// ^^^^^ reference typescript 5.3.3 lib/`lib.es5.d.ts`/Error.
@@ -94,10 +94,10 @@ export const objectLiteralImplementation: Superinterface = {
9494
// ^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`inheritance.ts`/Superinterface#
9595
property: 'property',
9696
//^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/property0:
97-
//relationship implementation reference scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/Superinterface#property.
97+
//relationship implementation reference syntax 1.0.0 src/`inheritance.ts`/Superinterface#property.
9898
interfaceMethod: (): string => {
9999
//^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/interfaceMethod0:
100-
//relationship implementation reference scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/Superinterface#interfaceMethod().
100+
//relationship implementation reference syntax 1.0.0 src/`inheritance.ts`/Superinterface#interfaceMethod().
101101
throw new Error('Function not implemented.')
102102
// ^^^^^ reference typescript 5.3.3 lib/`lib.es5.d.ts`/Error#
103103
// ^^^^^ reference typescript 5.3.3 lib/`lib.es5.d.ts`/Error.
@@ -113,10 +113,10 @@ export function infersInterface(): void {
113113
//^^^^^^^^^^^^^^^^^ reference syntax 1.0.0 src/`inheritance.ts`/consumesInterface().
114114
interfaceMethod: (): string => 'inferred',
115115
// ^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/interfaceMethod1:
116-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/Superinterface#interfaceMethod().
116+
// relationship implementation reference syntax 1.0.0 src/`inheritance.ts`/Superinterface#interfaceMethod().
117117
property: 'inferred',
118118
// ^^^^^^^^ definition syntax 1.0.0 src/`inheritance.ts`/property1:
119-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`inheritance.ts`/Superinterface#property.
119+
// relationship implementation reference syntax 1.0.0 src/`inheritance.ts`/Superinterface#property.
120120
})
121121
}
122122

snapshots/output/syntax/src/interface.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,17 @@ export function newInterface(): Interface {
1818
return {
1919
property: 'a',
2020
// ^^^^^^^^ definition syntax 1.0.0 src/`interface.ts`/property0:
21-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`interface.ts`/Interface#property.
21+
// relationship implementation reference syntax 1.0.0 src/`interface.ts`/Interface#property.
2222
methodSignature(param: string): string {
2323
// ^^^^^^^^^^^^^^^ definition local 4
24-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`interface.ts`/Interface#methodSignature().
24+
// relationship implementation reference syntax 1.0.0 src/`interface.ts`/Interface#methodSignature().
2525
// ^^^^^ definition local 5
2626
return param
2727
// ^^^^^ reference local 5
2828
},
2929
methodSignature2: (param: string): string => {
3030
// ^^^^^^^^^^^^^^^^ definition syntax 1.0.0 src/`interface.ts`/methodSignature20:
31-
// relationship implementation reference scip-typescript npm syntax 1.0.0 src/`interface.ts`/Interface#methodSignature2.
31+
// relationship implementation reference syntax 1.0.0 src/`interface.ts`/Interface#methodSignature2.
3232
// ^^^^^ definition local 7
3333
return param
3434
// ^^^^^ reference local 7

src/SnapshotTesting.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ function parseOptions(lines: string[]): {
4848
return formatOptions
4949
}
5050

51-
function symbolNameForSnapshot(occurrence: scip.Occurrence): string {
52-
return occurrence.symbol.startsWith(stripIndexerPrefix)
53-
? occurrence.symbol.slice(stripIndexerPrefix.length)
54-
: occurrence.symbol
51+
function symbolNameForSnapshot(fullName: string): string {
52+
return fullName.startsWith(stripIndexerPrefix)
53+
? fullName.slice(stripIndexerPrefix.length)
54+
: fullName
5555
}
5656

5757
export function formatSnapshot(
@@ -144,7 +144,7 @@ export function formatSnapshot(
144144
if (relationship.is_type_definition) {
145145
out.push(' type_definition')
146146
}
147-
out.push(' ' + relationship.symbol)
147+
out.push(' ' + symbolNameForSnapshot(relationship.symbol))
148148
}
149149
}
150150

@@ -181,7 +181,7 @@ export function formatSnapshot(
181181
out.push(' < ')
182182
out.push(isDefinition ? 'definition' : 'reference')
183183
out.push(' ')
184-
out.push(symbolNameForSnapshot(occurrence))
184+
out.push(symbolNameForSnapshot(occurrence.symbol))
185185
pushDoc(range, occurrence.symbol, isDefinition, true)
186186
out.push('\n')
187187

@@ -230,7 +230,7 @@ export function formatSnapshot(
230230
(occurrence.symbol_roles & scip.SymbolRole.Definition) > 0
231231
out.push(isDefinition ? 'definition' : 'reference')
232232
out.push(' ')
233-
const symbol = symbolNameForSnapshot(occurrence)
233+
const symbol = symbolNameForSnapshot(occurrence.symbol)
234234
out.push(symbol.replace('\n', '|'))
235235

236236
pushDoc(range, occurrence.symbol, isDefinition, isStartOfLine)

0 commit comments

Comments
 (0)