Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(189)

Unified Diff: pkg/string_scanner/test/string_scanner_test.dart

Issue 213833013: Add a string_scanner package. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/string_scanner/test/error_format_test.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/string_scanner/test/string_scanner_test.dart
diff --git a/pkg/shelf/test/string_scanner_test.dart b/pkg/string_scanner/test/string_scanner_test.dart
similarity index 92%
copy from pkg/shelf/test/string_scanner_test.dart
copy to pkg/string_scanner/test/string_scanner_test.dart
index 4d3d259e5802361fc2ff9737345b16e8571afbe9..0cab6273ebf2e2975bf374b26b7f14574abd76f2 100644
--- a/pkg/shelf/test/string_scanner_test.dart
+++ b/pkg/string_scanner/test/string_scanner_test.dart
@@ -2,9 +2,9 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library shelf.string_scanner_test;
+library string_scanner.string_scanner_test;
-import 'package:shelf/src/string_scanner.dart';
+import 'package:string_scanner/string_scanner.dart';
import 'package:unittest/unittest.dart';
void main() {
@@ -16,6 +16,7 @@ void main() {
test('is done', () {
expect(scanner.isDone, isTrue);
+ expect(scanner.expectDone, isNot(throwsFormatException));
});
test('rest is empty', () {
@@ -37,8 +38,7 @@ void main() {
});
test("expect throws a FormatException and doesn't change the state", () {
- expect(() => scanner.expect(new RegExp('.'), 'error'),
- throwsFormatException);
+ expect(() => scanner.expect(new RegExp('.')), throwsFormatException);
expect(scanner.lastMatch, isNull);
expect(scanner.position, equals(0));
});
@@ -70,6 +70,7 @@ void main() {
test('is not done', () {
expect(scanner.isDone, isFalse);
+ expect(scanner.expectDone, throwsFormatException);
});
test('rest is the whole string', () {
@@ -102,7 +103,7 @@ void main() {
});
test("a matching expect changes the state", () {
- scanner.expect(new RegExp('f(..)'), 'error');
+ scanner.expect(new RegExp('f(..)'));
expect(scanner.lastMatch[1], equals('oo'));
expect(scanner.position, equals(3));
expect(scanner.rest, equals(' bar'));
@@ -113,8 +114,7 @@ void main() {
expect(scanner.matches(new RegExp('f(..)')), isTrue);
expect(scanner.lastMatch, isNotNull);
- expect(() => scanner.expect(new RegExp('b(..)'), 'error'),
- throwsFormatException);
+ expect(() => scanner.expect(new RegExp('b(..)')), throwsFormatException);
expect(scanner.lastMatch, isNull);
expect(scanner.position, equals(0));
expect(scanner.rest, equals('foo bar'));
@@ -176,6 +176,7 @@ void main() {
expect(scanner.position, equals(7));
expect(scanner.rest, equals(''));
expect(scanner.isDone, isTrue);
+ expect(scanner.expectDone, isNot(throwsFormatException));
});
});
@@ -188,6 +189,7 @@ void main() {
test('is done', () {
expect(scanner.isDone, isTrue);
+ expect(scanner.expectDone, isNot(throwsFormatException));
});
test('rest is empty', () {
@@ -205,8 +207,7 @@ void main() {
});
test("expect throws a FormatException and sets lastMatch to null", () {
- expect(() => scanner.expect(new RegExp('.'), 'error'),
- throwsFormatException);
+ expect(() => scanner.expect(new RegExp('.')), throwsFormatException);
expect(scanner.lastMatch, isNull);
expect(scanner.position, equals(7));
});
« no previous file with comments | « pkg/string_scanner/test/error_format_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698