Skip to content

Commit c494ff9

Browse files
ampagenttmm
andcommitted
test(zero-swift): run the sweep JSON vectors on an 8 MB stack
A vector nests 1,000 deep, which overflows macOS's 512 KB test threads in a debug build. Amp-Thread-ID: https://ampcode.com/threads/T-c513a037-a257-45e0-b9a9-15c15edfe859 Co-authored-by: tmm <tmm@tmm.dev>
1 parent 850cd97 commit c494ff9

1 file changed

Lines changed: 22 additions & 18 deletions

File tree

‎swift/Tests/ConformanceTests/SweepWireTests.swift‎

Lines changed: 22 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -36,25 +36,29 @@ struct SweepWireTests {
3636

3737
/// `JSON.parse` acceptance, and `JSON.stringify` of what it parsed, keys
3838
/// in JS property order, for each input.
39-
@Test func json() throws {
40-
for c in try Vectors.cases("sweep-json") {
41-
let input = c["input"]!.stringValue!
42-
let ok = c["ok"]!.boolValue!
43-
let value: JSONValue
44-
do {
45-
value = try JSONParser.parse(input)
46-
} catch {
47-
#expect(!ok, "rejected \(String(reflecting: input)): \(error)")
48-
continue
39+
/// On an 8 MB stack, as `deepRowValue`: a vector nests 1,000 deep.
40+
@Test func json() async throws {
41+
let cases = try Vectors.cases("sweep-json")
42+
try await onLargeStack {
43+
for c in cases {
44+
let input = c["input"]!.stringValue!
45+
let ok = c["ok"]!.boolValue!
46+
let value: JSONValue
47+
do {
48+
value = try JSONParser.parse(input)
49+
} catch {
50+
#expect(!ok, "rejected \(String(reflecting: input)): \(error)")
51+
continue
52+
}
53+
#expect(ok, "accepted \(String(reflecting: input))")
54+
guard ok else { continue }
55+
let expected = c["stringify"]!.stringValue!
56+
let actual = JSONSerializer.stringify(value)
57+
#expect(
58+
Self.same(actual, expected),
59+
"\(String(reflecting: input)): Swift \(actual.debugDescription), JS \(expected.debugDescription)"
60+
)
4961
}
50-
#expect(ok, "accepted \(String(reflecting: input))")
51-
guard ok else { continue }
52-
let expected = c["stringify"]!.stringValue!
53-
let actual = JSONSerializer.stringify(value)
54-
#expect(
55-
Self.same(actual, expected),
56-
"\(String(reflecting: input)): Swift \(actual.debugDescription), JS \(expected.debugDescription)"
57-
)
5862
}
5963
}
6064

0 commit comments

Comments
 (0)