mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-30 01:04:49 -05:00
Don’t require fourslash completions tests to specify replacementSpan when it’s zero-length (#42013)
This commit is contained in:
@@ -907,11 +907,13 @@ namespace FourSlash {
|
||||
this.raiseError(`Expected completion insert text to be ${expected.insertText}, got ${actual.insertText}`);
|
||||
}
|
||||
const convertedReplacementSpan = expected.replacementSpan && ts.createTextSpanFromRange(expected.replacementSpan);
|
||||
try {
|
||||
assert.deepEqual(actual.replacementSpan, convertedReplacementSpan);
|
||||
}
|
||||
catch {
|
||||
this.raiseError(`Expected completion replacementSpan to be ${stringify(convertedReplacementSpan)}, got ${stringify(actual.replacementSpan)}`);
|
||||
if (convertedReplacementSpan?.length) {
|
||||
try {
|
||||
assert.deepEqual(actual.replacementSpan, convertedReplacementSpan);
|
||||
}
|
||||
catch {
|
||||
this.raiseError(`Expected completion replacementSpan to be ${stringify(convertedReplacementSpan)}, got ${stringify(actual.replacementSpan)}`);
|
||||
}
|
||||
}
|
||||
|
||||
if (expected.kind !== undefined || expected.kindModifiers !== undefined) {
|
||||
|
||||
@@ -2,12 +2,9 @@
|
||||
// @strict: true
|
||||
|
||||
//// declare function get<T, K extends keyof T>(obj: T, key: K): T[K];
|
||||
//// get({ hello: 123, world: 456 }, "[|/**/|]");
|
||||
//// get({ hello: 123, world: 456 }, "/**/");
|
||||
|
||||
verify.completions({
|
||||
marker: "",
|
||||
includes: [
|
||||
{ name: 'hello', replacementSpan: test.ranges()[0] },
|
||||
{ name: 'world', replacementSpan: test.ranges()[0] }
|
||||
]
|
||||
includes: ["hello", "world"]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user