Skip to content

Commit 42d38b2

Browse files
committed
Added test case for situation where enum is partially handled by the user at the moment refactoring is invoked
1 parent e7811f5 commit 42d38b2

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
enum E {
2+
case e1
3+
case e2
4+
case e3
5+
case e4
6+
}
7+
8+
func foo(e: E) -> Int {
9+
switch e {
10+
case .e1: return 5
11+
case .e2: <#code#>
12+
case .e3: <#code#>
13+
case .e4: <#code#>
14+
}
15+
}

test/refactoring/ExpandSwitchCases/partially_handled.swift

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ enum E {
66
}
77

88
func foo(e: E) -> Int {
9-
switch e { }
9+
switch e {
10+
case .e1: return 5
11+
}
1012
}
1113
// RUN: rm -rf %t.result && mkdir -p %t.result
12-
// RUN: %refactor -expand-switch-cases -source-filename %s -pos=9:8 >> %t.result/L10.swift
13-
// RUN: diff -u %S/Outputs/partially_handled/L10.swift.expected %t.result/L10.swift
14+
// RUN: %refactor -expand-switch-cases -source-filename %s -pos=9:8 >> %t.result/L11.swift
15+
// RUN: diff -u %S/Outputs/partially_handled/L11.swift.expected %t.result/L11.swift

0 commit comments

Comments
 (0)