| Index: pkg/matcher/test/pretty_print_test.dart
|
| diff --git a/pkg/unittest/test/pretty_print_test.dart b/pkg/matcher/test/pretty_print_test.dart
|
| similarity index 76%
|
| copy from pkg/unittest/test/pretty_print_test.dart
|
| copy to pkg/matcher/test/pretty_print_test.dart
|
| index 826c345187835125ed807af2ec34150d7bce95f4..919bba96743a0228eea1eff473ac4dc04c127de4 100644
|
| --- a/pkg/unittest/test/pretty_print_test.dart
|
| +++ b/pkg/matcher/test/pretty_print_test.dart
|
| @@ -2,11 +2,13 @@
|
| // 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/src/pretty_print.dart';
|
| -import 'package:unittest/unittest.dart';
|
| +import 'package:unittest/unittest.dart' as ut;
|
| +
|
| +import 'package:matcher/matcher.dart';
|
| +import 'package:matcher/src/pretty_print.dart';
|
|
|
| void main() {
|
| - test('with primitive objects', () {
|
| + ut.test('with primitive objects', () {
|
| expect(prettyPrint(12), equals('<12>'));
|
| expect(prettyPrint(12.13), equals('<12.13>'));
|
| expect(prettyPrint(true), equals('<true>'));
|
| @@ -15,30 +17,30 @@ void main() {
|
| matches(r'<Closure(: \(\) => dynamic)?>'));
|
| });
|
|
|
| - group('with a string', () {
|
| - test('containing simple characters', () {
|
| + ut.group('with a string', () {
|
| + ut.test('containing simple characters', () {
|
| expect(prettyPrint('foo'), equals("'foo'"));
|
| });
|
|
|
| - test('containing newlines', () {
|
| + ut.test('containing newlines', () {
|
| expect(prettyPrint('foo\nbar\nbaz'), equals(
|
| "'foo\\n'\n"
|
| " 'bar\\n'\n"
|
| " 'baz'"));
|
| });
|
|
|
| - test('containing escapable characters', () {
|
| + ut.test('containing escapable characters', () {
|
| expect(prettyPrint("foo\rbar\tbaz'qux"),
|
| equals("'foo\\rbar\\tbaz\\'qux'"));
|
| });
|
| });
|
|
|
| - group('with an iterable', () {
|
| - test('containing primitive objects', () {
|
| + ut.group('with an iterable', () {
|
| + ut.test('containing primitive objects', () {
|
| expect(prettyPrint([1, true, 'foo']), equals("[1, true, 'foo']"));
|
| });
|
|
|
| - test('containing a multiline string', () {
|
| + ut.test('containing a multiline string', () {
|
| expect(prettyPrint(['foo', 'bar\nbaz\nbip', 'qux']), equals("[\n"
|
| " 'foo',\n"
|
| " 'bar\\n'\n"
|
| @@ -48,17 +50,17 @@ void main() {
|
| "]"));
|
| });
|
|
|
| - test('containing a matcher', () {
|
| + ut.test('containing a matcher', () {
|
| expect(prettyPrint(['foo', endsWith('qux')]),
|
| equals("['foo', <a string ending with 'qux'>]"));
|
| });
|
|
|
| - test("that's under maxLineLength", () {
|
| + ut.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]"));
|
| });
|
|
|
| - test("that's over maxLineLength", () {
|
| + ut.test("that's over maxLineLength", () {
|
| expect(prettyPrint([0, 1, 2, 3, 4, 5, 6, 7, 8, 9], maxLineLength: 29),
|
| equals("[\n"
|
| " 0,\n"
|
| @@ -74,7 +76,7 @@ void main() {
|
| "]"));
|
| });
|
|
|
| - test("factors indentation into maxLineLength", () {
|
| + ut.test("factors indentation into maxLineLength", () {
|
| expect(prettyPrint([
|
| "foo\nbar",
|
| [0, 1, 2, 3, 4, 5, 6, 7, 8, 9],
|
| @@ -96,30 +98,30 @@ void main() {
|
| "]"));
|
| });
|
|
|
| - test("that's under maxItems", () {
|
| + ut.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]"));
|
| });
|
|
|
| - test("that's over maxItems", () {
|
| + ut.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, ...]"));
|
| });
|
|
|
| - test("that's recursive", () {
|
| + ut.test("that's recursive", () {
|
| var list = [1, 2, 3];
|
| list.add(list);
|
| expect(prettyPrint(list), equals("[1, 2, 3, (recursive)]"));
|
| });
|
| });
|
|
|
| - group("with a map", () {
|
| - test('containing primitive objects', () {
|
| + ut.group("with a map", () {
|
| + ut.test('containing primitive objects', () {
|
| expect(prettyPrint({'foo': 1, 'bar': true}),
|
| equals("{'foo': 1, 'bar': true}"));
|
| });
|
|
|
| - test('containing a multiline string key', () {
|
| + ut.test('containing a multiline string key', () {
|
| expect(prettyPrint({'foo\nbar': 1, 'bar': true}), equals("{\n"
|
| " 'foo\\n'\n"
|
| " 'bar': 1,\n"
|
| @@ -127,7 +129,7 @@ void main() {
|
| "}"));
|
| });
|
|
|
| - test('containing a multiline string value', () {
|
| + ut.test('containing a multiline string value', () {
|
| expect(prettyPrint({'foo': 'bar\nbaz', 'qux': true}), equals("{\n"
|
| " 'foo': 'bar\\n'\n"
|
| " 'baz',\n"
|
| @@ -135,7 +137,7 @@ void main() {
|
| "}"));
|
| });
|
|
|
| - test('containing a multiline string key/value pair', () {
|
| + ut.test('containing a multiline string key/value pair', () {
|
| expect(prettyPrint({'foo\nbar': 'baz\nqux'}), equals("{\n"
|
| " 'foo\\n'\n"
|
| " 'bar': 'baz\\n'\n"
|
| @@ -143,22 +145,22 @@ void main() {
|
| "}"));
|
| });
|
|
|
| - test('containing a matcher key', () {
|
| + ut.test('containing a matcher key', () {
|
| expect(prettyPrint({endsWith('bar'): 'qux'}),
|
| equals("{<a string ending with 'bar'>: 'qux'}"));
|
| });
|
|
|
| - test('containing a matcher value', () {
|
| + ut.test('containing a matcher value', () {
|
| expect(prettyPrint({'foo': endsWith('qux')}),
|
| equals("{'foo': <a string ending with 'qux'>}"));
|
| });
|
|
|
| - test("that's under maxLineLength", () {
|
| + ut.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}"));
|
| });
|
|
|
| - test("that's over maxLineLength", () {
|
| + ut.test("that's over maxLineLength", () {
|
| expect(prettyPrint({'0': 1, '2': 3, '4': 5, '6': 7}, maxLineLength: 31),
|
| equals("{\n"
|
| " '0': 1,\n"
|
| @@ -168,7 +170,7 @@ void main() {
|
| "}"));
|
| });
|
|
|
| - test("factors indentation into maxLineLength", () {
|
| + ut.test("factors indentation into maxLineLength", () {
|
| expect(prettyPrint(["foo\nbar", {'0': 1, '2': 3, '4': 5, '6': 7}],
|
| maxLineLength: 32),
|
| equals("[\n"
|
| @@ -183,12 +185,12 @@ void main() {
|
| "]"));
|
| });
|
|
|
| - test("that's under maxItems", () {
|
| + ut.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}"));
|
| });
|
|
|
| - test("that's over maxItems", () {
|
| + ut.test("that's over maxItems", () {
|
| expect(prettyPrint({'0': 1, '2': 3, '4': 5, '6': 7}, maxItems: 3),
|
| equals("{'0': 1, '2': 3, ...}"));
|
| });
|
|
|