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

Unified Diff: pkg/matcher/test/pretty_print_test.dart

Issue 199793010: pkg/matcher: test cleanup (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: nits 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
Index: pkg/matcher/test/pretty_print_test.dart
diff --git a/pkg/matcher/test/pretty_print_test.dart b/pkg/matcher/test/pretty_print_test.dart
index 919bba96743a0228eea1eff473ac4dc04c127de4..27bbfadf137743b5b5c59513c636ca2a213327dd 100644
--- a/pkg/matcher/test/pretty_print_test.dart
+++ b/pkg/matcher/test/pretty_print_test.dart
@@ -2,13 +2,14 @@
// 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.
-import 'package:unittest/unittest.dart' as ut;
+library matcher.pretty_print_test;
import 'package:matcher/matcher.dart';
import 'package:matcher/src/pretty_print.dart';
+import 'package:unittest/unittest.dart' show group, test;
void main() {
- ut.test('with primitive objects', () {
+ test('with primitive objects', () {
expect(prettyPrint(12), equals('<12>'));
expect(prettyPrint(12.13), equals('<12.13>'));
expect(prettyPrint(true), equals('<true>'));
@@ -17,30 +18,30 @@ void main() {
matches(r'<Closure(: \(\) => dynamic)?>'));
});
- ut.group('with a string', () {
- ut.test('containing simple characters', () {
+ group('with a string', () {
+ test('containing simple characters', () {
expect(prettyPrint('foo'), equals("'foo'"));
});
- ut.test('containing newlines', () {
+ test('containing newlines', () {
expect(prettyPrint('foo\nbar\nbaz'), equals(
"'foo\\n'\n"
" 'bar\\n'\n"
" 'baz'"));
});
- ut.test('containing escapable characters', () {
+ test('containing escapable characters', () {
expect(prettyPrint("foo\rbar\tbaz'qux"),
equals("'foo\\rbar\\tbaz\\'qux'"));
});
});
- ut.group('with an iterable', () {
- ut.test('containing primitive objects', () {
+ group('with an iterable', () {
+ test('containing primitive objects', () {
expect(prettyPrint([1, true, 'foo']), equals("[1, true, 'foo']"));
});
- ut.test('containing a multiline string', () {
+ test('containing a multiline string', () {
expect(prettyPrint(['foo', 'bar\nbaz\nbip', 'qux']), equals("[\n"
" 'foo',\n"
" 'bar\\n'\n"
@@ -50,17 +51,17 @@ void main() {
"]"));
});
- ut.test('containing a matcher', () {
+ test('containing a matcher', () {
expect(prettyPrint(['foo', endsWith('qux')]),
equals("['foo', <a string ending with 'qux'>]"));
});
- ut.test("that's under maxLineLength", () {
+ test("that's under maxLineLength", () {
expect(prettyPrint([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], maxLineLength: 30),
equals("[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"));
});
- ut.test("that's over maxLineLength", () {
+ test("that's over maxLineLength", () {
expect(prettyPrint([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], maxLineLength: 29),
equals("[\n"
" 0,\n"
@@ -76,7 +77,7 @@ void main() {
"]"));
});
- ut.test("factors indentation into maxLineLength", () {
+ test("factors indentation into maxLineLength", () {
expect(prettyPrint([
"foo\nbar",
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
@@ -98,30 +99,30 @@ void main() {
"]"));
});
- ut.test("that's under maxItems", () {
+ test("that's under maxItems", () {
expect(prettyPrint([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], maxItems: 10),
equals("[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]"));
});
- ut.test("that's over maxItems", () {
+ test("that's over maxItems", () {
expect(prettyPrint([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], maxItems: 9),
equals("[0, 1, 2, 3, 4, 5, 6, 7, ...]"));
});
- ut.test("that's recursive", () {
+ test("that's recursive", () {
var list = [1, 2, 3];
list.add(list);
expect(prettyPrint(list), equals("[1, 2, 3, (recursive)]"));
});
});
- ut.group("with a map", () {
- ut.test('containing primitive objects', () {
+ group("with a map", () {
+ test('containing primitive objects', () {
expect(prettyPrint({'foo': 1, 'bar': true}),
equals("{'foo': 1, 'bar': true}"));
});
- ut.test('containing a multiline string key', () {
+ test('containing a multiline string key', () {
expect(prettyPrint({'foo\nbar': 1, 'bar': true}), equals("{\n"
" 'foo\\n'\n"
" 'bar': 1,\n"
@@ -129,7 +130,7 @@ void main() {
"}"));
});
- ut.test('containing a multiline string value', () {
+ test('containing a multiline string value', () {
expect(prettyPrint({'foo': 'bar\nbaz', 'qux': true}), equals("{\n"
" 'foo': 'bar\\n'\n"
" 'baz',\n"
@@ -137,7 +138,7 @@ void main() {
"}"));
});
- ut.test('containing a multiline string key/value pair', () {
+ test('containing a multiline string key/value pair', () {
expect(prettyPrint({'foo\nbar': 'baz\nqux'}), equals("{\n"
" 'foo\\n'\n"
" 'bar': 'baz\\n'\n"
@@ -145,22 +146,22 @@ void main() {
"}"));
});
- ut.test('containing a matcher key', () {
+ test('containing a matcher key', () {
expect(prettyPrint({endsWith('bar'): 'qux'}),
equals("{<a string ending with 'bar'>: 'qux'}"));
});
- ut.test('containing a matcher value', () {
+ test('containing a matcher value', () {
expect(prettyPrint({'foo': endsWith('qux')}),
equals("{'foo': <a string ending with 'qux'>}"));
});
- ut.test("that's under maxLineLength", () {
+ test("that's under maxLineLength", () {
expect(prettyPrint({'0': 1, '2': 3, '4': 5, '6': 7}, maxLineLength: 32),
equals("{'0': 1, '2': 3, '4': 5, '6': 7}"));
});
- ut.test("that's over maxLineLength", () {
+ test("that's over maxLineLength", () {
expect(prettyPrint({'0': 1, '2': 3, '4': 5, '6': 7}, maxLineLength: 31),
equals("{\n"
" '0': 1,\n"
@@ -170,7 +171,7 @@ void main() {
"}"));
});
- ut.test("factors indentation into maxLineLength", () {
+ test("factors indentation into maxLineLength", () {
expect(prettyPrint(["foo\nbar", {'0': 1, '2': 3, '4': 5, '6': 7}],
maxLineLength: 32),
equals("[\n"
@@ -185,12 +186,12 @@ void main() {
"]"));
});
- ut.test("that's under maxItems", () {
+ test("that's under maxItems", () {
expect(prettyPrint({'0': 1, '2': 3, '4': 5, '6': 7}, maxItems: 4),
equals("{'0': 1, '2': 3, '4': 5, '6': 7}"));
});
- ut.test("that's over maxItems", () {
+ test("that's over maxItems", () {
expect(prettyPrint({'0': 1, '2': 3, '4': 5, '6': 7}, maxItems: 3),
equals("{'0': 1, '2': 3, ...}"));
});
« no previous file with comments | « pkg/matcher/test/pretty_print_minified_test.dart ('k') | pkg/matcher/test/pretty_print_unminified_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698