Skip to content

Replace if true with do #1761

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/1_stdlib/ArrayBridge.swift
Original file line number Diff line number Diff line change
Expand Up @@ -381,23 +381,23 @@ func testExplicitlyBridged() {
print(bridgedSwiftsAsAnyObjects[1])

// Downcasts of non-verbatim bridged value types to objects.
if true {
do {
let downcasted = bridgedSwifts as [BridgedObjC]
// CHECK-NEXT: BridgedObjC#[[ID0:[0-9]+]](42)
print(downcasted[0])
// CHECK-NEXT: BridgedObjC#[[ID1:[0-9]+]](17)
print(downcasted[1])
}

if true {
do {
let downcasted = bridgedSwifts as [Base]
// CHECK-NEXT: BridgedObjC#[[ID0:[0-9]+]](42)
print(downcasted[0])
// CHECK-NEXT: BridgedObjC#[[ID1:[0-9]+]](17)
print(downcasted[1])
}

if true {
do {
let downcasted = bridgedSwifts as [AnyObject]
// CHECK-NEXT: BridgedObjC#[[ID0:[0-9]+]](42)
print(downcasted[0])
Expand Down
4 changes: 2 additions & 2 deletions test/1_stdlib/BridgeStorage.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ allTests.test("${Self}") {
expectTrue(B(objC: oy).objCInstance == oy)

for i in 0..<2 {
if true {
do {
var b = B(native: C(), bits: i)
expectFalse(b.isObjC)
expectTrue(b.isNative)
Expand All @@ -137,7 +137,7 @@ allTests.test("${Self}") {
expectEqual(i, b.spareBits)
}

if true {
do {
let c = C()
var b = B(native: c, bits: i)
expectFalse(b.isObjC)
Expand Down
8 changes: 4 additions & 4 deletions test/1_stdlib/Character.swift
Original file line number Diff line number Diff line change
Expand Up @@ -116,25 +116,25 @@ func randomGraphemeCluster(minSize: Int, _ maxSize: Int) -> String {
var CharacterTests = TestSuite("Character")

CharacterTests.test("literal") {
if true {
do {
// U+0041 LATIN CAPITAL LETTER A
let ch: Character = "A"
expectEqual("\u{0041}", String(ch))
}

if true {
do {
// U+3042 HIRAGANA LETTER A
let ch: Character = "あ"
expectEqual("\u{3042}", String(ch))
}

if true {
do {
// U+4F8B CJK UNIFIED IDEOGRAPH-4F8B
let ch: Character = "例"
expectEqual("\u{4F8B}", String(ch))
}

if true {
do {
// U+304B HIRAGANA LETTER KA
// U+3099 COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK
let ch: Character = "\u{304b}\u{3099}"
Expand Down
4 changes: 2 additions & 2 deletions test/1_stdlib/Interval.swift
Original file line number Diff line number Diff line change
Expand Up @@ -190,11 +190,11 @@ IntervalTestSuite.test("CustomStringConvertible/CustomDebugStringConvertible") {
}

IntervalTestSuite.test("rdar12016900") {
if true {
do {
let wc = 0
expectFalse((0x00D800 ..< 0x00E000).contains(wc))
}
if true {
do {
let wc = 0x00D800
expectTrue((0x00D800 ..< 0x00E000).contains(wc))
}
Expand Down
6 changes: 3 additions & 3 deletions test/1_stdlib/ManagedBuffer.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,13 +144,13 @@ class MyBuffer<T> {
var tests = TestSuite("ManagedBuffer")

tests.test("basic") {
if true {
do {
let s = TestManagedBuffer<LifetimeTracked>.create(0)
expectEqual(1, LifetimeTracked.instances)
}

expectEqual(0, LifetimeTracked.instances)
if true {
do {
let s = TestManagedBuffer<LifetimeTracked>.create(10)
expectEqual(0, s.count)
expectLE(10, s.myCapacity)
Expand Down Expand Up @@ -198,7 +198,7 @@ tests.test("ManagedBufferPointer/SizeValidation/MyBuffer") {
tests.test("ManagedBufferPointer") {
typealias Manager = ManagedBufferPointer<CountAndCapacity, LifetimeTracked>

if true {
do {
var mgr = Manager(
bufferClass: TestManagedBuffer<LifetimeTracked>.self,
minimumCapacity: 10
Expand Down
4 changes: 2 additions & 2 deletions test/1_stdlib/NSArrayAPI.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ import Foundation
var NSArrayAPI = TestSuite("NSArrayAPI")

NSArrayAPI.test("mixed types with AnyObject") {
if true {
do {
let result: AnyObject = [1, "two"]
let expect: NSArray = [1, "two"]
expectEqual(expect, result as! NSArray)
}
if true {
do {
let result: AnyObject = [1, 2]
let expect: NSArray = [1, 2]
expectEqual(expect, result as! NSArray)
Expand Down
2 changes: 1 addition & 1 deletion test/1_stdlib/NewArray.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ func testInoutViolation() {
]

%for A in arrayTypes:
if true {
do {
var b = ${A}(a)
b.sorted { x, y in
b.removeAll()
Expand Down
2 changes: 1 addition & 1 deletion test/1_stdlib/Optional.swift
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ OptionalTests.test("nil comparison") {
x = .some(1)
expectTrue(x != nil)

if true {
do {
var y1: Int? = .none
expectTrue(y1 == nil)

Expand Down
12 changes: 6 additions & 6 deletions test/1_stdlib/Strideable.swift
Original file line number Diff line number Diff line change
Expand Up @@ -142,33 +142,33 @@ StrideTestSuite.test("OperatorOverloads") {
var r2 = R(70)
var stride: Int = 5

if true {
do {
var result = r1 + stride
expectType(R.self, &result)
expectEqual(55, result.x)
}
if true {
do {
var result = stride + r1
expectType(R.self, &result)
expectEqual(55, result.x)
}
if true {
do {
var result = r1 - stride
expectType(R.self, &result)
expectEqual(45, result.x)
}
if true {
do {
var result = r1 - r2
expectType(Int.self, &result)
expectEqual(-20, result)
}
if true {
do {
var result = r1
result += stride
expectType(R.self, &result)
expectEqual(55, result.x)
}
if true {
do {
var result = r1
result -= stride
expectType(R.self, &result)
Expand Down
4 changes: 2 additions & 2 deletions test/1_stdlib/UnsafePointer.swift.gyb
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,12 @@ ${SelfName}TestSuite.test("initFromUnsafeMutablePointer") {
}

${SelfName}TestSuite.test("initFromInteger") {
if true {
do {
let word: Int = 0x12345678
let ptr = ${SelfType}(bitPattern: word)
expectEqual(word, unsafeBitCast(ptr, to: Int.self))
}
if true {
do {
let uword: UInt = 0x12345678
let ptr = ${SelfType}(bitPattern: uword)
expectEqual(uword, unsafeBitCast(ptr, to: UInt.self))
Expand Down
8 changes: 4 additions & 4 deletions validation-test/stdlib/ExistentialCollection.swift
Original file line number Diff line number Diff line change
Expand Up @@ -132,13 +132,13 @@ struct InstrumentedIndex<I : RandomAccessIndex> : RandomAccessIndex {
}

tests.test("AnySequence.init(Sequence)") {
if true {
do {
let base = MinimalSequence<OpaqueValue<Int>>(elements: [])
var s = AnySequence(base)
expectType(AnySequence<OpaqueValue<Int>>.self, &s)
checkSequence([], s, resiliencyChecks: .none) { $0.value == $1.value }
}
if true {
do {
let intData = [ 1, 2, 3, 5, 8, 13, 21 ]
let data = intData.map(OpaqueValue.init)
let base = MinimalSequence(elements: data)
Expand All @@ -149,14 +149,14 @@ tests.test("AnySequence.init(Sequence)") {
}

tests.test("AnySequence.init(() -> Generator)") {
if true {
do {
var s = AnySequence {
return MinimalIterator<OpaqueValue<Int>>([])
}
expectType(AnySequence<OpaqueValue<Int>>.self, &s)
checkSequence([], s, resiliencyChecks: .none) { $0.value == $1.value }
}
if true {
do {
let intData = [ 1, 2, 3, 5, 8, 13, 21 ]
let data = intData.map(OpaqueValue.init)
var s = AnySequence {
Expand Down