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

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

Issue 299973002: Add LineScanner and SpanScanner classes to string_scanner. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 7 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_test.dart ('k') | pkg/string_scanner/test/line_scanner_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/string_scanner/test/expect_error_test.dart
diff --git a/pkg/string_scanner/test/expect_error_test.dart b/pkg/string_scanner/test/expect_error_test.dart
deleted file mode 100644
index 3596e15e5cf053054edb4fb3f373fd3ff0004d39..0000000000000000000000000000000000000000
--- a/pkg/string_scanner/test/expect_error_test.dart
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file
-// 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 string_scanner.expect_error_test;
-
-import 'package:string_scanner/string_scanner.dart';
-import 'package:unittest/unittest.dart';
-
-import 'utils.dart';
-
-void main() {
- test('points to the first unconsumed character', () {
- var scanner = new StringScanner('foo bar baz');
- scanner.expect('foo ');
- expect(() => scanner.expect('foo'), throwsFormattedError('''
-Error on line 1, column 5: expected "foo".
-foo bar baz
- ^'''));
- });
-
- test('prints the correct line', () {
- var scanner = new StringScanner('foo bar baz\ndo re mi\nearth fire water');
- scanner.expect('foo bar baz\ndo ');
- expect(() => scanner.expect('foo'), throwsFormattedError('''
-Error on line 2, column 4: expected "foo".
-do re mi
- ^'''));
- });
-
- test('handles the beginning of the string correctly', () {
- var scanner = new StringScanner('foo bar baz');
- expect(() => scanner.expect('zap'), throwsFormattedError('''
-Error on line 1, column 1: expected "zap".
-foo bar baz
-^'''));
- });
-
- test('handles the end of the string correctly', () {
- var scanner = new StringScanner('foo bar baz');
- scanner.expect('foo bar baz');
- expect(() => scanner.expect('bang'), throwsFormattedError('''
-Error on line 1, column 12: expected "bang".
-foo bar baz
- ^'''));
- });
-
- test('handles an empty string correctly', () {
- expect(() => new StringScanner('').expect('foo'), throwsFormattedError('''
-Error on line 1, column 1: expected "foo".
-
-^'''));
- });
-
- group("expected name", () {
- test("uses the provided name", () {
- expect(() => new StringScanner('').expect('foo bar', name: 'zap'),
- throwsFormattedError('''
-Error on line 1, column 1: expected zap.
-
-^'''));
- });
-
- test("escapes string quotes", () {
- expect(() => new StringScanner('').expect('foo"bar'),
- throwsFormattedError('''
-Error on line 1, column 1: expected "foo\\"bar".
-
-^'''));
- });
-
- test("escapes string backslashes", () {
- expect(() => new StringScanner('').expect('foo\\bar'),
- throwsFormattedError('''
-Error on line 1, column 1: expected "foo\\\\bar".
-
-^'''));
- });
-
- test("prints PERL-style regexps", () {
- expect(() => new StringScanner('').expect(new RegExp(r'foo')),
- throwsFormattedError('''
-Error on line 1, column 1: expected /foo/.
-
-^'''));
- });
-
- test("escape regexp forward slashes", () {
- expect(() => new StringScanner('').expect(new RegExp(r'foo/bar')),
- throwsFormattedError('''
-Error on line 1, column 1: expected /foo\\/bar/.
-
-^'''));
- });
-
- test("does not escape regexp backslashes", () {
- expect(() => new StringScanner('').expect(new RegExp(r'foo\bar')),
- throwsFormattedError('''
-Error on line 1, column 1: expected /foo\\bar/.
-
-^'''));
- });
- });
-}
« no previous file with comments | « pkg/string_scanner/test/error_test.dart ('k') | pkg/string_scanner/test/line_scanner_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698