Fix source_span tests. R=rnystrom@google.com Review URL: https://codereview.chromium.org//712473002 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart/pkg/source_span@41614 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/pkgs/source_span/lib/src/file.dart b/pkgs/source_span/lib/src/file.dart index 5680733..14aa226 100644 --- a/pkgs/source_span/lib/src/file.dart +++ b/pkgs/source_span/lib/src/file.dart
@@ -207,6 +207,11 @@ FileSpan._(this.file, this._start, this._end) { if (_end < _start) { throw new ArgumentError('End $_end must come after start $_start.'); + } else if (_end > file.length) { + throw new RangeError("End $_end must not be greater than the number " + "of characters in the file, ${file.length}."); + } else if (_start < 0) { + throw new RangeError("Start may not be negative, was $_start."); } }