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

This commit is contained in:
Ian Hickson 2016-05-18 12:34:43 -07:00
parent dacfdb64cf
commit ef563c485e
2 changed files with 2 additions and 1 deletions

View File

@ -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 &&

View File

@ -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);