| Index: test/string_scanner_test.dart
|
| diff --git a/test/string_scanner_test.dart b/test/string_scanner_test.dart
|
| index 0b4d4824f0bf2bf64cb85f4799d4cdceb004fc07..55ffa0a9f0c98792aa96294071fff8f0e7a20f4b 100644
|
| --- a/test/string_scanner_test.dart
|
| +++ b/test/string_scanner_test.dart
|
| @@ -261,6 +261,32 @@ void main() {
|
| });
|
| });
|
|
|
| + group('after a scan', () {
|
| + var scanner;
|
| + setUp(() {
|
| + scanner = new StringScanner('foo bar');
|
| + expect(scanner.scan('foo'), isTrue);
|
| + });
|
| +
|
| + test('readChar returns the first character and unsets the last match', () {
|
| + expect(scanner.readChar(), equals($space));
|
| + expect(scanner.lastMatch, isNull);
|
| + expect(scanner.position, equals(4));
|
| + });
|
| +
|
| + test('a matching scanChar returns true and unsets the last match', () {
|
| + expect(scanner.scanChar($space), isTrue);
|
| + expect(scanner.lastMatch, isNull);
|
| + expect(scanner.position, equals(4));
|
| + });
|
| +
|
| + test('a matching expectChar returns true and unsets the last match', () {
|
| + scanner.expectChar($space);
|
| + expect(scanner.lastMatch, isNull);
|
| + expect(scanner.position, equals(4));
|
| + });
|
| + });
|
| +
|
| group('at the end of a string', () {
|
| var scanner;
|
| setUp(() {
|
| @@ -346,6 +372,13 @@ void main() {
|
| expect(scanner.rest, equals('bar'));
|
| });
|
|
|
| + test('setting and resetting position clears lastMatch', () {
|
| + var oldPosition = scanner.position;
|
| + scanner.position = 1;
|
| + scanner.position = oldPosition;
|
| + expect(scanner.lastMatch, isNull);
|
| + });
|
| +
|
| test('setting position beyond the string throws an ArgumentError', () {
|
| expect(() {
|
| scanner.position = 8;
|
|
|