Skip to content

Commit 1680ec3

Browse files
authored
Merge pull request #41853 from ahoppen/pr/add-fixed-test-cases
[CodeCompletion] Add test cases
2 parents 8f791c1 + 4af49e3 commit 1680ec3

File tree

3 files changed

+94
-0
lines changed

3 files changed

+94
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
// RUN: %swift-ide-test -code-completion -source-filename %s -code-completion-token=COMPLETE
2+
3+
@resultBuilder public struct ViewBuilder2 {
4+
public static func buildBlock<Content>(_ content: Content) -> Never
5+
}
6+
7+
public struct NavigationLink2<Label, Destination> {
8+
public init(destination: Destination, @ViewBuilder2 label: () -> Label)
9+
public init(_ titleKey: String, destination: Destination)
10+
}
11+
12+
struct MoviePosterImage2 {
13+
var imageLoader: Movie2
14+
}
15+
struct MovieDetail2 {}
16+
struct Movie2 {}
17+
18+
struct MoviesHomeGridMoviesRow {
19+
func foo() {
20+
let movie: Movie2
21+
_ = NavigationLink2(destination: MovieDetail2()) {
22+
MoviePosterImage2(imageLoader: movie.#^COMPLETE^#
23+
24+
struct MoviesHomeGridMoviesRow_Previews {
25+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
// RUN: %swift-ide-test --code-completion --source-filename %s --code-completion-token=COMPLETE
2+
3+
@resultBuilder struct ViewBuilder2 {
4+
static func buildBlock() -> Never { fatalError() }
5+
static func buildBlock<Content>(_ content: Content) -> Content where Content : View2 { fatalError() }
6+
}
7+
8+
protocol View2 {}
9+
10+
extension View2 {
11+
func qadding(_ edges: Set2) -> some View2 { fatalError() }
12+
func pnAppear(perform action: (() -> Void)? = nil) -> some View2 { fatalError() }
13+
}
14+
15+
struct EmptyView2: View2 {}
16+
17+
struct Set2 {
18+
static let bottom = Set2()
19+
}
20+
21+
22+
struct AdaptsToSoftwareKeyboard {
23+
24+
@ViewBuilder2 func body(content: EmptyView2) -> some View2 {
25+
content
26+
.qadding(.#^COMPLETE^#bottom)
27+
.pnAppear(perform: subscribeToKeyboardEvents)
28+
}
29+
30+
private func subscribeToKeyboardEvents() {}
31+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// RUN: %swift-ide-test --code-completion --source-filename %s --code-completion-token=COMPLETE
2+
3+
struct ItemDetailView {
4+
private var itemViewModel: Int
5+
@ViewBuilder2 var body: some View2 {
6+
Text2()
7+
.environmens(\.horizontalSizeClass2, .#^COMPLETE^#regular)
8+
.onDisappeaq {
9+
self.itemViewModel
10+
}
11+
}
12+
}
13+
14+
protocol View2 {}
15+
16+
extension View2 {
17+
func onDisappeaq(perform action: (() -> Swift.Void)? = nil) -> some View2 {
18+
fatalError()
19+
}
20+
}
21+
22+
@resultBuilder struct ViewBuilder2 {
23+
static func buildBlock() -> Never { fatalError() }
24+
static func buildBlock<Content>(_ content: Content) -> Content where Content : View2 { fatalError() }
25+
}
26+
27+
enum Foo {
28+
case regular
29+
}
30+
31+
struct EnvironmentValues2 {
32+
public var horizontalSizeClass2: Foo
33+
}
34+
35+
public struct Text2 : View2 {
36+
public init() { fatalError() }
37+
func environmens<V>(_ keyPath: WritableKeyPath<EnvironmentValues2, V>, _ value: V) -> some View2 { fatalError() }
38+
}

0 commit comments

Comments
 (0)