Files
swift-mirror/test/refactoring/rename/enum.swift
Alex Hoppen a710111001 [SourceKit] Support building sourcekitd without building swift-syntax
This allows building sourcekitd and swift-refactor with `SWIFT_BUILD_SWIFT_SYNTAX=NO`. In these builds, the `relatedidents` and `find-syntactic-rename-ranges` requests will always return an error.
2023-12-04 19:14:01 -08:00

27 lines
1.4 KiB
Swift

enum Foo {
case first(associated: Int)
case second
}
func test() {
let _ = Foo.first(associated: 1)
let _ = Foo.first
let _ = Foo.second
}
// REQUIRES: swift_swift_parser
// RUN: %empty-directory(%t.result)
// RUN: %refactor -find-local-rename-ranges -source-filename %s -pos=2:8 > %t.result/first_def.swift
// RUN: diff -u %S/Outputs/enum/first.swift.expected %t.result/first_def.swift
// RUN: %refactor -find-local-rename-ranges -source-filename %s -pos=7:15 -new-name 'primary(with:)' > %t.result/first_ref.swift
// RUN: diff -u %S/Outputs/enum/first.swift.expected %t.result/first_ref.swift
// RUN: %refactor -find-local-rename-ranges -source-filename %s -pos=7:21 -new-name 'primary(with:)' > %t.result/first_ref_assoc.swift
// RUN: diff -u %S/Outputs/enum/first.swift.expected %t.result/first_ref_assoc.swift
// RUN: %refactor -find-local-rename-ranges -source-filename %s -pos=8:15 -new-name 'primary(with:)' > %t.result/first_ref_base.swift
// RUN: diff -u %S/Outputs/enum/first.swift.expected %t.result/first_ref_assoc.swift
// RUN: %refactor -find-local-rename-ranges -source-filename %s -pos=3:8 -new-name 'secondary' > %t.result/second_def.swift
// RUN: diff -u %S/Outputs/enum/second.swift.expected %t.result/second_def.swift
// RUN: %refactor -find-local-rename-ranges -source-filename %s -pos=9:15 -new-name 'secondary' > %t.result/second_ref.swift
// RUN: diff -u %S/Outputs/enum/second.swift.expected %t.result/second_ref.swift