Skip to content

Commit c7bb91d

Browse files
committed
[Backtracing] Tweak tests slightly.
`JSONEncoder` by default will escape slashes, which results in a string that isn't technically valid Base64. Since that behaviour is optional, turn it off, and at the same time tell it to output in lexical key order, which makes the test slightly simpler (no `CHECK-DAG` needed). Also fixed a typo in `test_swift.py` rdar://124913332
1 parent 6c0749d commit c7bb91d

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

test/Backtracing/CodableBacktrace.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ func level5() {
3333
let backtrace = try! Backtrace.capture()
3434

3535
let encoder = JSONEncoder()
36-
encoder.outputFormatting = .prettyPrinted
36+
encoder.outputFormatting = [.prettyPrinted,.sortedKeys,.withoutEscapingSlashes]
3737

3838
let data = try! encoder.encode(backtrace)
3939
let json = String(data: data, encoding: .utf8)!
4040

4141
print(json)
4242

4343
// CHECK: {
44-
// CHECK-DAG: "architecture" : "{{.*}}"
45-
// CHECK-DAG: "backtrace" : "{{[A-Za-z0-9+/]*}}"
44+
// CHECK: "architecture" : "{{.*}}",
45+
// CHECK: "backtrace" : "{{[A-Za-z0-9+/]*}}"
4646
// CHECK: }
4747

4848
let decoder = JSONDecoder()

utils/swift_build_support/tests/products/test_swift.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -484,7 +484,7 @@ def test_runtime_module_flags(self):
484484
['-DSWIFT_ENABLE_RUNTIME_MODULE:BOOL='
485485
'TRUE'],
486486
[x for x in swift.cmake_options
487-
if 'DSWIFT_ENABLE_RUNTIME_MODULE in x])
487+
if 'DSWIFT_ENABLE_RUNTIME_MODULE' in x])
488488

489489
def test_freestanding_is_darwin_flags(self):
490490
self.args.swift_freestanding_is_darwin = True

0 commit comments

Comments
 (0)