Skip to content

Commit 8f61c05

Browse files
committed
Merge pull request #1761 from frootloops/do
Replace if true with do
2 parents 2c75cfb + 9dbf4c9 commit 8f61c05

11 files changed

+30
-30
lines changed

test/1_stdlib/ArrayBridge.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -381,23 +381,23 @@ func testExplicitlyBridged() {
381381
print(bridgedSwiftsAsAnyObjects[1])
382382

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

392-
if true {
392+
do {
393393
let downcasted = bridgedSwifts as [Base]
394394
// CHECK-NEXT: BridgedObjC#[[ID0:[0-9]+]](42)
395395
print(downcasted[0])
396396
// CHECK-NEXT: BridgedObjC#[[ID1:[0-9]+]](17)
397397
print(downcasted[1])
398398
}
399399

400-
if true {
400+
do {
401401
let downcasted = bridgedSwifts as [AnyObject]
402402
// CHECK-NEXT: BridgedObjC#[[ID0:[0-9]+]](42)
403403
print(downcasted[0])

test/1_stdlib/BridgeStorage.swift.gyb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ allTests.test("${Self}") {
126126
expectTrue(B(objC: oy).objCInstance == oy)
127127

128128
for i in 0..<2 {
129-
if true {
129+
do {
130130
var b = B(native: C(), bits: i)
131131
expectFalse(b.isObjC)
132132
expectTrue(b.isNative)
@@ -137,7 +137,7 @@ allTests.test("${Self}") {
137137
expectEqual(i, b.spareBits)
138138
}
139139

140-
if true {
140+
do {
141141
let c = C()
142142
var b = B(native: c, bits: i)
143143
expectFalse(b.isObjC)

test/1_stdlib/Character.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -116,25 +116,25 @@ func randomGraphemeCluster(minSize: Int, _ maxSize: Int) -> String {
116116
var CharacterTests = TestSuite("Character")
117117

118118
CharacterTests.test("literal") {
119-
if true {
119+
do {
120120
// U+0041 LATIN CAPITAL LETTER A
121121
let ch: Character = "A"
122122
expectEqual("\u{0041}", String(ch))
123123
}
124124

125-
if true {
125+
do {
126126
// U+3042 HIRAGANA LETTER A
127127
let ch: Character = ""
128128
expectEqual("\u{3042}", String(ch))
129129
}
130130

131-
if true {
131+
do {
132132
// U+4F8B CJK UNIFIED IDEOGRAPH-4F8B
133133
let ch: Character = ""
134134
expectEqual("\u{4F8B}", String(ch))
135135
}
136136

137-
if true {
137+
do {
138138
// U+304B HIRAGANA LETTER KA
139139
// U+3099 COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK
140140
let ch: Character = "\u{304b}\u{3099}"

test/1_stdlib/Interval.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,11 @@ IntervalTestSuite.test("CustomStringConvertible/CustomDebugStringConvertible") {
190190
}
191191

192192
IntervalTestSuite.test("rdar12016900") {
193-
if true {
193+
do {
194194
let wc = 0
195195
expectFalse((0x00D800 ..< 0x00E000).contains(wc))
196196
}
197-
if true {
197+
do {
198198
let wc = 0x00D800
199199
expectTrue((0x00D800 ..< 0x00E000).contains(wc))
200200
}

test/1_stdlib/ManagedBuffer.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,13 +144,13 @@ class MyBuffer<T> {
144144
var tests = TestSuite("ManagedBuffer")
145145

146146
tests.test("basic") {
147-
if true {
147+
do {
148148
let s = TestManagedBuffer<LifetimeTracked>.create(0)
149149
expectEqual(1, LifetimeTracked.instances)
150150
}
151151

152152
expectEqual(0, LifetimeTracked.instances)
153-
if true {
153+
do {
154154
let s = TestManagedBuffer<LifetimeTracked>.create(10)
155155
expectEqual(0, s.count)
156156
expectLE(10, s.myCapacity)
@@ -198,7 +198,7 @@ tests.test("ManagedBufferPointer/SizeValidation/MyBuffer") {
198198
tests.test("ManagedBufferPointer") {
199199
typealias Manager = ManagedBufferPointer<CountAndCapacity, LifetimeTracked>
200200

201-
if true {
201+
do {
202202
var mgr = Manager(
203203
bufferClass: TestManagedBuffer<LifetimeTracked>.self,
204204
minimumCapacity: 10

test/1_stdlib/NSArrayAPI.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,12 @@ import Foundation
1818
var NSArrayAPI = TestSuite("NSArrayAPI")
1919

2020
NSArrayAPI.test("mixed types with AnyObject") {
21-
if true {
21+
do {
2222
let result: AnyObject = [1, "two"]
2323
let expect: NSArray = [1, "two"]
2424
expectEqual(expect, result as! NSArray)
2525
}
26-
if true {
26+
do {
2727
let result: AnyObject = [1, 2]
2828
let expect: NSArray = [1, 2]
2929
expectEqual(expect, result as! NSArray)

test/1_stdlib/NewArray.swift.gyb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ func testInoutViolation() {
411411
]
412412

413413
%for A in arrayTypes:
414-
if true {
414+
do {
415415
var b = ${A}(a)
416416
b.sorted { x, y in
417417
b.removeAll()

test/1_stdlib/Optional.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ OptionalTests.test("nil comparison") {
5252
x = .some(1)
5353
expectTrue(x != nil)
5454

55-
if true {
55+
do {
5656
var y1: Int? = .none
5757
expectTrue(y1 == nil)
5858

test/1_stdlib/Strideable.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -142,33 +142,33 @@ StrideTestSuite.test("OperatorOverloads") {
142142
var r2 = R(70)
143143
var stride: Int = 5
144144

145-
if true {
145+
do {
146146
var result = r1 + stride
147147
expectType(R.self, &result)
148148
expectEqual(55, result.x)
149149
}
150-
if true {
150+
do {
151151
var result = stride + r1
152152
expectType(R.self, &result)
153153
expectEqual(55, result.x)
154154
}
155-
if true {
155+
do {
156156
var result = r1 - stride
157157
expectType(R.self, &result)
158158
expectEqual(45, result.x)
159159
}
160-
if true {
160+
do {
161161
var result = r1 - r2
162162
expectType(Int.self, &result)
163163
expectEqual(-20, result)
164164
}
165-
if true {
165+
do {
166166
var result = r1
167167
result += stride
168168
expectType(R.self, &result)
169169
expectEqual(55, result.x)
170170
}
171-
if true {
171+
do {
172172
var result = r1
173173
result -= stride
174174
expectType(R.self, &result)

test/1_stdlib/UnsafePointer.swift.gyb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,12 @@ ${SelfName}TestSuite.test("initFromUnsafeMutablePointer") {
9393
}
9494

9595
${SelfName}TestSuite.test("initFromInteger") {
96-
if true {
96+
do {
9797
let word: Int = 0x12345678
9898
let ptr = ${SelfType}(bitPattern: word)
9999
expectEqual(word, unsafeBitCast(ptr, to: Int.self))
100100
}
101-
if true {
101+
do {
102102
let uword: UInt = 0x12345678
103103
let ptr = ${SelfType}(bitPattern: uword)
104104
expectEqual(uword, unsafeBitCast(ptr, to: UInt.self))

validation-test/stdlib/ExistentialCollection.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -132,13 +132,13 @@ struct InstrumentedIndex<I : RandomAccessIndex> : RandomAccessIndex {
132132
}
133133

134134
tests.test("AnySequence.init(Sequence)") {
135-
if true {
135+
do {
136136
let base = MinimalSequence<OpaqueValue<Int>>(elements: [])
137137
var s = AnySequence(base)
138138
expectType(AnySequence<OpaqueValue<Int>>.self, &s)
139139
checkSequence([], s, resiliencyChecks: .none) { $0.value == $1.value }
140140
}
141-
if true {
141+
do {
142142
let intData = [ 1, 2, 3, 5, 8, 13, 21 ]
143143
let data = intData.map(OpaqueValue.init)
144144
let base = MinimalSequence(elements: data)
@@ -149,14 +149,14 @@ tests.test("AnySequence.init(Sequence)") {
149149
}
150150

151151
tests.test("AnySequence.init(() -> Generator)") {
152-
if true {
152+
do {
153153
var s = AnySequence {
154154
return MinimalIterator<OpaqueValue<Int>>([])
155155
}
156156
expectType(AnySequence<OpaqueValue<Int>>.self, &s)
157157
checkSequence([], s, resiliencyChecks: .none) { $0.value == $1.value }
158158
}
159-
if true {
159+
do {
160160
let intData = [ 1, 2, 3, 5, 8, 13, 21 ]
161161
let data = intData.map(OpaqueValue.init)
162162
var s = AnySequence {

0 commit comments

Comments
 (0)