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

Unified Diff: pkg/unittest/test/pretty_print_unminified_test.dart

Issue 15492003: Split out unittest tests whose behavior differs in minified mode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. Created 7 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/unittest/test/pretty_print_test.dart ('k') | pkg/unittest/test/test_common.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/unittest/test/pretty_print_unminified_test.dart
diff --git a/pkg/unittest/test/pretty_print_unminified_test.dart b/pkg/unittest/test/pretty_print_unminified_test.dart
new file mode 100644
index 0000000000000000000000000000000000000000..4417bcbfd76660e85a5e25fb76b2aa731a43b7c5
--- /dev/null
+++ b/pkg/unittest/test/pretty_print_unminified_test.dart
@@ -0,0 +1,58 @@
+// Copyright (c) 2012, 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.
+
+// This file is for pretty-print tests that rely on the names of various Dart
+// types. These tests will fail when run in minified dart2js, since the names
+// will be mangled. A version of this file that works in minified dart2js is in
+// pretty_print_minified_test.dart.
+
+import 'dart:collection';
+
+import 'package:unittest/src/pretty_print.dart';
+import 'package:unittest/unittest.dart';
+
+class DefaultToString {}
+
+class CustomToString {
+ String toString() => "string representation";
+}
+
+class _PrivateName {
+ String toString() => "string representation";
+}
+
+class _PrivateNameIterable extends IterableMixin {
+ Iterator get iterator => [1, 2, 3].iterator;
+}
+
+void main() {
+ group('with an object', () {
+ test('with a default [toString]', () {
+ expect(prettyPrint(new DefaultToString()),
+ equals("<Instance of 'DefaultToString'>"));
+ });
+
+ test('with a custom [toString]', () {
+ expect(prettyPrint(new CustomToString()),
+ equals('CustomToString:<string representation>'));
+ });
+
+ test('with a custom [toString] and a private name', () {
+ expect(prettyPrint(new _PrivateName()),
+ equals('?:<string representation>'));
+ });
+ });
+
+ group('with an iterable', () {
+ test("that's not a list", () {
+ expect(prettyPrint([1, 2, 3, 4].map((n) => n * 2)),
+ equals("MappedListIterable:[2, 4, 6, 8]"));
+ });
+
+ test("that's not a list and has a private name", () {
+ expect(prettyPrint(new _PrivateNameIterable()),
+ equals("?:[1, 2, 3]"));
+ });
+ });
+}
« no previous file with comments | « pkg/unittest/test/pretty_print_test.dart ('k') | pkg/unittest/test/test_common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698