Skip to content

Commit 0f73076

Browse files
committed
tests: Use demangled value in assertion
Mangled swift is unstable and differs a lot between versions
1 parent 738c199 commit 0f73076

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

features/handled_errors.feature

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Scenario: Override errorClass and message from a notifyError() callback and disc
1212
And the exception "errorClass" equals "Bar"
1313
And the exception "message" equals "Foo"
1414
And the event "device.time" is within 30 seconds of the current timestamp
15-
And the "method" of stack frame 0 equals "$S10iOSTestApp28HandledErrorOverrideScenarioC3runyyF"
15+
And the "method" of stack frame 0 demangles to "iOSTestApp.HandledErrorOverrideScenario.run() -> ()"
1616
And the stack trace is an array with 15 stack frames
1717

1818
Scenario: Reporting an NSError

features/steps/ios_steps.rb

+6
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@
120120
assert_not_nil(match, "No crumb matches the provided message")
121121
end
122122

123+
Then("the {string} of stack frame {int} demangles to {string}") do |field, frame_index, expected_value|
124+
value = read_key_path(find_request(0)[:body], "events.0.exceptions.0.stacktrace.#{frame_index}.#{field}")
125+
demangled_value = `xcrun swift-demangle -compact '#{value}'`.chomp
126+
assert_equal(expected_value, demangled_value)
127+
end
128+
123129
Then("the stack trace is an array with {int} stack frames") do |expected_length|
124130
stack_trace = read_key_path(find_request(0)[:body], "events.0.exceptions.0.stacktrace")
125131
assert_equal(expected_length, stack_trace.length)

0 commit comments

Comments
 (0)