| Index: pkg/string_scanner/test/string_scanner_test.dart
|
| diff --git a/pkg/string_scanner/test/string_scanner_test.dart b/pkg/string_scanner/test/string_scanner_test.dart
|
| index 0cab6273ebf2e2975bf374b26b7f14574abd76f2..6144bf9c007c3dcc30b09684d9899df46c8ddf68 100644
|
| --- a/pkg/string_scanner/test/string_scanner_test.dart
|
| +++ b/pkg/string_scanner/test/string_scanner_test.dart
|
| @@ -31,6 +31,18 @@ void main() {
|
| expect(scanner.position, equals(0));
|
| });
|
|
|
| + test("readChar fails and doesn't change the state", () {
|
| + expect(scanner.readChar, throwsFormatException);
|
| + expect(scanner.lastMatch, isNull);
|
| + expect(scanner.position, equals(0));
|
| + });
|
| +
|
| + test("peekChar returns null and doesn't change the state", () {
|
| + expect(scanner.peekChar(), isNull);
|
| + expect(scanner.lastMatch, isNull);
|
| + expect(scanner.position, equals(0));
|
| + });
|
| +
|
| test("scan returns false and doesn't change the state", () {
|
| expect(scanner.scan(new RegExp('.')), isFalse);
|
| expect(scanner.lastMatch, isNull);
|
| @@ -85,6 +97,24 @@ void main() {
|
| expect(scanner.position, equals(0));
|
| });
|
|
|
| + test('readChar returns the first character and moves forward', () {
|
| + expect(scanner.readChar(), equals(0x66));
|
| + expect(scanner.lastMatch, isNull);
|
| + expect(scanner.position, equals(1));
|
| + });
|
| +
|
| + test('peekChar returns the first character', () {
|
| + expect(scanner.peekChar(), equals(0x66));
|
| + expect(scanner.lastMatch, isNull);
|
| + expect(scanner.position, equals(0));
|
| + });
|
| +
|
| + test('peekChar with an argument returns the nth character', () {
|
| + expect(scanner.peekChar(4), equals(0x62));
|
| + expect(scanner.lastMatch, isNull);
|
| + expect(scanner.position, equals(0));
|
| + });
|
| +
|
| test("a matching scan returns true and changes the state", () {
|
| expect(scanner.scan(new RegExp('f(..)')), isTrue);
|
| expect(scanner.lastMatch[1], equals('oo'));
|
| @@ -200,6 +230,18 @@ void main() {
|
| expect(scanner.position, equals(7));
|
| });
|
|
|
| + test("readChar fails and doesn't change the state", () {
|
| + expect(scanner.readChar, throwsFormatException);
|
| + expect(scanner.lastMatch, isNotNull);
|
| + expect(scanner.position, equals(7));
|
| + });
|
| +
|
| + test("peekChar returns null and doesn't change the state", () {
|
| + expect(scanner.peekChar(), isNull);
|
| + expect(scanner.lastMatch, isNotNull);
|
| + expect(scanner.position, equals(7));
|
| + });
|
| +
|
| test("scan returns false and sets lastMatch to null", () {
|
| expect(scanner.scan(new RegExp('.')), isFalse);
|
| expect(scanner.lastMatch, isNull);
|
|
|