Commit ef563c48 authored by Ian Hickson's avatar Ian Hickson

Handle stack traces that don't give column numbers (#4016)

parent dacfdb64
...@@ -15,7 +15,7 @@ int reportExpectCall(StackTrace stack, StringBuffer information) { ...@@ -15,7 +15,7 @@ int reportExpectCall(StackTrace stack, StringBuffer information) {
final RegExp line0 = new RegExp(r'^#0 +fail \(.+\)$'); final RegExp line0 = new RegExp(r'^#0 +fail \(.+\)$');
final RegExp line1 = new RegExp(r'^#1 +expect \(.+\)$'); final RegExp line1 = new RegExp(r'^#1 +expect \(.+\)$');
final RegExp line2 = new RegExp(r'^#2 +expect \(.+\)$'); final RegExp line2 = new RegExp(r'^#2 +expect \(.+\)$');
final RegExp line3 = new RegExp(r'^#3 +[^(]+ \((.+):([0-9]+):[0-9]+\)$'); final RegExp line3 = new RegExp(r'^#3 +[^(]+ \((.+?):([0-9]+)(?::[0-9]+)?\)$');
final List<String> stackLines = stack.toString().split('\n'); final List<String> stackLines = stack.toString().split('\n');
if (line0.firstMatch(stackLines[0]) != null && if (line0.firstMatch(stackLines[0]) != null &&
line1.firstMatch(stackLines[1]) != null && line1.firstMatch(stackLines[1]) != null &&
......
...@@ -8,6 +8,7 @@ void main() { ...@@ -8,6 +8,7 @@ void main() {
test('stack manipulation: reportExpectCall', () { test('stack manipulation: reportExpectCall', () {
try { try {
expect(false, isTrue); expect(false, isTrue);
throw 'unexpectedly did not throw';
} catch (e, stack) { } catch (e, stack) {
StringBuffer information = new StringBuffer(); StringBuffer information = new StringBuffer();
expect(reportExpectCall(stack, information), 3); expect(reportExpectCall(stack, information), 3);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment