Skip to content

Commit 94271b5

Browse files
authored
test/stdlib/StringAPICString.swift: disable crashing tests on WASI
1 parent 2b69325 commit 94271b5

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

test/stdlib/StringAPICString.swift

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77

88
import StdlibUnittest
99

10+
#if os(WASI)
11+
let enableCrashTests = false
12+
#else
13+
let enableCrashTests = true
14+
#endif
15+
1016
var CStringTests = TestSuite("CStringTests")
1117

1218
func getNullUTF8() -> UnsafeMutablePointer<UInt8>? {
@@ -239,6 +245,7 @@ CStringTests.test("String.cString.with.Array.UInt8.input") {
239245
}
240246
}
241247
}
248+
guard enableCrashTests else { return }
242249
// no need to test every case; that is covered in other tests
243250
expectCrashLater(
244251
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
@@ -263,6 +270,7 @@ CStringTests.test("String.cString.with.Array.CChar.input") {
263270
}
264271
}
265272
}
273+
guard enableCrashTests else { return }
266274
// no need to test every case; that is covered in other tests
267275
expectCrashLater(
268276
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
@@ -292,6 +300,7 @@ CStringTests.test("String.cString.with.inout.UInt8.conversion") {
292300
var str = String(cString: &c)
293301
expectTrue(str.isEmpty)
294302
c = 100
303+
guard enableCrashTests else { return }
295304
expectCrashLater(
296305
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
297306
// withMessage: "input of String.init(cString:) must be null-terminated"
@@ -306,6 +315,7 @@ CStringTests.test("String.cString.with.inout.CChar.conversion") {
306315
var str = String(cString: &c)
307316
expectTrue(str.isEmpty)
308317
c = 100
318+
guard enableCrashTests else { return }
309319
expectCrashLater(
310320
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
311321
// withMessage: "input of String.init(cString:) must be null-terminated"
@@ -330,6 +340,7 @@ CStringTests.test("String.validatingUTF8.with.Array.input") {
330340
}
331341
}
332342
}
343+
guard enableCrashTests else { return }
333344
// no need to test every case; that is covered in other tests
334345
expectCrashLater(
335346
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
@@ -362,6 +373,7 @@ CStringTests.test("String.validatingUTF8.with.inout.conversion") {
362373
expectNotNil(str)
363374
expectEqual(str?.isEmpty, true)
364375
c = 100
376+
guard enableCrashTests else { return }
365377
expectCrashLater(
366378
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
367379
// withMessage: "input of String.init(validatingUTF8:) must be null-terminated"
@@ -387,6 +399,7 @@ CStringTests.test("String.decodeCString.with.Array.input") {
387399
}
388400
}
389401
}
402+
guard enableCrashTests else { return }
390403
// no need to test every case; that is covered in other tests
391404
expectCrashLater(
392405
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
@@ -426,6 +439,7 @@ CStringTests.test("String.decodeCString.with.inout.conversion") {
426439
expectEqual(result?.result.isEmpty, true)
427440
expectEqual(result?.repairsMade, false)
428441
c = 100
442+
guard enableCrashTests else { return }
429443
expectCrashLater(
430444
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
431445
// withMessage: "input of decodeCString(_:as:repairingInvalidCodeUnits:) must be null-terminated"
@@ -449,6 +463,7 @@ CStringTests.test("String.init.decodingCString.with.Array.input") {
449463
}
450464
}
451465
}
466+
guard enableCrashTests else { return }
452467
// no need to test every case; that is covered in other tests
453468
expectCrashLater(
454469
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
@@ -478,6 +493,7 @@ CStringTests.test("String.init.decodingCString.with.inout.conversion") {
478493
var str = String(decodingCString: &c, as: Unicode.UTF8.self)
479494
expectEqual(str.isEmpty, true)
480495
c = 100
496+
guard enableCrashTests else { return }
481497
expectCrashLater(
482498
// Workaround for https://github.com/apple/swift/issues/58362 (rdar://91365967)
483499
// withMessage: "input of String.init(decodingCString:as:) must be null-terminated"

0 commit comments

Comments
 (0)