Files
swift-mirror/test/refactoring/CollapseNestedIf/basic.swift
Saleem Abdulrasool b67d5f0cf7 test: convert rm -rf && mkdir -p into %empty-directory
This converts the instances of the pattern for which we have a proper
substitution in lit.  This will make it easier to replace it
appropriately with Windows equivalents.
2018-03-06 14:30:54 -08:00

34 lines
1.0 KiB
Swift

func testCollapseNestedIf() {
let a = 3
if a > 2 {
if a < 10 {}
}
}
func testMultiConditionalNestedIf() {
let a = 3
if a > 2, a != 4 {
if a < 10, a != 5 {}
}
}
func testLetNestedIf() {
let a: Int? = 3
if let b = a {
if b != 5 {}
}
}
func testCaseLetNestedIf() {
let a: Int? = 3
if case .some(let b) = a {
if b != 5 {}
}
}
// RUN: %empty-directory(%t.result)
// RUN: %refactor -collapse-nested-if -source-filename %s -pos=3:3 > %t.result/L3-3.swift
// RUN: diff -u %S/Outputs/basic/L3-3.swift.expected %t.result/L3-3.swift
// RUN: %refactor -collapse-nested-if -source-filename %s -pos=9:3 > %t.result/L9-3.swift
// RUN: diff -u %S/Outputs/basic/L9-3.swift.expected %t.result/L9-3.swift
// RUN: %refactor -collapse-nested-if -source-filename %s -pos=15:3 > %t.result/L15-3.swift
// RUN: diff -u %S/Outputs/basic/L15-3.swift.expected %t.result/L15-3.swift
// RUN: %refactor -collapse-nested-if -source-filename %s -pos=21:3 > %t.result/L21-3.swift
// RUN: diff -u %S/Outputs/basic/L21-3.swift.expected %t.result/L21-3.swift