OLD | NEW |
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library string_scanner.span_scanner_test; | 5 library string_scanner.span_scanner_test; |
6 | 6 |
7 import 'package:string_scanner/string_scanner.dart'; | 7 import 'package:string_scanner/string_scanner.dart'; |
8 import 'package:unittest/unittest.dart'; | 8 import 'package:test/test.dart'; |
9 | 9 |
10 void main() { | 10 void main() { |
11 var scanner; | 11 var scanner; |
12 setUp(() { | 12 setUp(() { |
13 scanner = new SpanScanner('foo\nbar\nbaz', sourceUrl: 'source'); | 13 scanner = new SpanScanner('foo\nbar\nbaz', sourceUrl: 'source'); |
14 }); | 14 }); |
15 | 15 |
16 test("tracks the span for the last match", () { | 16 test("tracks the span for the last match", () { |
17 scanner.scan('fo'); | 17 scanner.scan('fo'); |
18 scanner.scan('o\nba'); | 18 scanner.scan('o\nba'); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 expect(span.start.sourceUrl, equals(Uri.parse('source'))); | 51 expect(span.start.sourceUrl, equals(Uri.parse('source'))); |
52 | 52 |
53 expect(span.end.offset, equals(6)); | 53 expect(span.end.offset, equals(6)); |
54 expect(span.end.line, equals(1)); | 54 expect(span.end.line, equals(1)); |
55 expect(span.end.column, equals(2)); | 55 expect(span.end.column, equals(2)); |
56 expect(span.start.sourceUrl, equals(Uri.parse('source'))); | 56 expect(span.start.sourceUrl, equals(Uri.parse('source'))); |
57 | 57 |
58 expect(span.text, equals('')); | 58 expect(span.text, equals('')); |
59 }); | 59 }); |
60 } | 60 } |
OLD | NEW |