Chromium Code Reviews| Index: tests/compiler/dart2js/source_map_validator_helper.dart |
| diff --git a/tests/compiler/dart2js/source_map_validator_helper.dart b/tests/compiler/dart2js/source_map_validator_helper.dart |
| index 934a63c5a219c5b0293884a86640ea7ce211a299..afebda0853ce628e0c3958e744f3e20358b4eefa 100644 |
| --- a/tests/compiler/dart2js/source_map_validator_helper.dart |
| +++ b/tests/compiler/dart2js/source_map_validator_helper.dart |
| @@ -14,9 +14,41 @@ validateSourceMap(Uri targetUri) { |
| Uri mapUri = getMapUri(targetUri); |
| SingleMapping sourceMap = getSourceMap(mapUri); |
| checkFileReferences(targetUri, mapUri, sourceMap); |
| + checkIndexReferences(targetUri, mapUri, sourceMap); |
| checkRedundancy(sourceMap); |
| } |
| +checkIndexReferences(Uri targetUri, Uri mapUri, SingleMapping sourceMap) { |
| + List<String> target = |
| + new File.fromUri(targetUri).readAsStringSync().split('\n'); |
| + int urlsLength = sourceMap.urls.length; |
| + List<List<String>> sources = new List(urlsLength); |
| + print('Reading sources'); |
| + for (int i = 0; i < urlsLength; i++) { |
| + sources[i] = new File.fromUri(mapUri.resolve(sourceMap.urls[i])). |
| + readAsStringSync().split('\n'); |
| + } |
| + |
| + sourceMap.lines.forEach((TargetLineEntry line) { |
| + Expect.isTrue(line.line < target.length); |
|
Johnni Winther
2014/04/10 12:55:01
Check that line.line >= 1 (or is it 0?)
zarah
2014/04/10 13:46:19
Done.
|
| + for (TargetEntry entry in line.entries) { |
| + int urlIndex = entry.sourceUrlId; |
| + |
| + // TODO(zarah): Entry columns sometimes point one or more characters too |
| + // far. Incomment this check when this is fixed. |
| + // |
| + // Expect.isTrue(entry.column < target[line.line].length); |
|
Johnni Winther
2014/04/10 12:55:01
Check entry.column >= 1 (or 0?)
zarah
2014/04/10 13:46:19
Done.
|
| + Expect.isTrue(urlIndex == null || urlIndex < urlsLength); |
|
Johnni Winther
2014/04/10 12:55:01
Check urlIndex >= 0.
zarah
2014/04/10 13:46:19
Done.
|
| + Expect.isTrue(entry.sourceLine == null || |
| + entry.sourceLine < sources[urlIndex].length); |
|
Johnni Winther
2014/04/10 12:55:01
Check entry.sourceLine >= 1 (or 1?).
zarah
2014/04/10 13:46:19
Done.
|
| + Expect.isTrue(entry.sourceColumn == null || |
| + entry.sourceColumn < sources[urlIndex][entry.sourceLine].length); |
|
Johnni Winther
2014/04/10 12:55:01
Ditto.
zarah
2014/04/10 13:46:19
Done.
|
| + Expect.isTrue(entry.sourceNameId == null || |
| + entry.sourceNameId < sourceMap.names.length); |
|
Johnni Winther
2014/04/10 12:55:01
Ditto.
zarah
2014/04/10 13:46:19
Done.
|
| + } |
| + }); |
| +} |
| + |
| checkFileReferences(Uri targetUri, Uri mapUri, SingleMapping sourceMap) { |
| Expect.equals(targetUri, mapUri.resolve(sourceMap.targetUrl)); |
| print('Checking sources'); |