mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Update the cursor requests to also pass in their primary file. Snapshots should be compared using this file, not the input buffer name. This fixes AST re-use when the AST is usable with snapshots. Resolves rdar://110344363.
24 lines
1.1 KiB
Swift
24 lines
1.1 KiB
Swift
// RUN: %empty-directory(%t)
|
|
// RUN: touch %t/empty.swift %t/func.swift
|
|
|
|
// Check that cursor info re-uses the underlying AST if it's able to based
|
|
// off edit snapshots.
|
|
|
|
// RUN: %sourcekitd-test \
|
|
// RUN: -shell -- echo '## State 1' == \
|
|
// RUN: -req=open -text-input %t/empty.swift %t/func.swift -- %t/func.swift == \
|
|
// RUN: -req=edit -offset=0 -length=0 -replace="func foo() {}" -req-opts=enablesyntaxmap=0,enablesubstructure=0,enablediagnostics=0,syntactic_only=1 %t/func.swift -- %t/func.swift == \
|
|
// RUN: -req=cursor -offset=5 %t/func.swift -- %t/func.swift == \
|
|
// RUN: -shell -- echo '## State 2' == \
|
|
// RUN: -req=edit -offset=0 -length=0 -replace="/* some comment */ " -req-opts=enablesyntaxmap=0,enablesubstructure=0,enablediagnostics=0,syntactic_only=1 %t/func.swift -- %t/func.swift == \
|
|
// RUN: -req=cursor -offset=24 %t/func.swift -- %t/func.swift | %FileCheck %s
|
|
|
|
// CHECK: ## State 1
|
|
// CHECK: source.lang.swift.decl.function.free
|
|
// CHECK: foo()
|
|
// CHECK: DID REUSE AST CONTEXT: 0
|
|
// CHECK: ## State 2
|
|
// CHECK: source.lang.swift.decl.function.free
|
|
// CHECK: foo()
|
|
// CHECK: DID REUSE AST CONTEXT: 1
|