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

Side by Side Diff: tests/corelib/errors_test.dart

Issue 1137233004: Make more use of ArgumentError.value in js_lib. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import "package:expect/expect.dart"; 5 import "package:expect/expect.dart";
6 6
7 // Test that error constructors do what they are documented as doing. 7 // Test that error constructors do what they are documented as doing.
8 8
9 main() { 9 main() {
10 Expect.equals("Invalid argument(s)", 10 Expect.equals("Invalid argument(s)",
11 new ArgumentError().toString()); 11 new ArgumentError().toString());
12 Expect.equals("Invalid argument(s): message", 12 Expect.equals("Invalid argument(s): message",
13 new ArgumentError("message").toString()); 13 new ArgumentError("message").toString());
14 Expect.equals("Invalid argument: null", 14 Expect.equals("Invalid argument: null",
15 new ArgumentError.value(null).toString()); 15 new ArgumentError.value(null).toString());
16 Expect.equals("Invalid argument: 42",
17 new ArgumentError.value(42).toString());
18 Expect.equals("Invalid argument: \"bad\"",
19 new ArgumentError.value("bad").toString());
16 Expect.equals("Invalid argument (foo): null", 20 Expect.equals("Invalid argument (foo): null",
17 new ArgumentError.value(null, "foo").toString()); 21 new ArgumentError.value(null, "foo").toString());
18 Expect.equals("Invalid argument (foo): 42", 22 Expect.equals("Invalid argument (foo): 42",
19 new ArgumentError.value(42, "foo").toString()); 23 new ArgumentError.value(42, "foo").toString());
20 Expect.equals("Invalid argument (foo): message: 42", 24 Expect.equals("Invalid argument (foo): message: 42",
21 new ArgumentError.value(42, "foo", "message").toString()); 25 new ArgumentError.value(42, "foo", "message").toString());
22 Expect.equals("Invalid argument: message: 42", 26 Expect.equals("Invalid argument: message: 42",
23 new ArgumentError.value(42, null, "message").toString()); 27 new ArgumentError.value(42, null, "message").toString());
24 Expect.equals("Invalid argument: Must not be null: null", 28 Expect.equals("Invalid argument: Must not be null: null",
25 new ArgumentError.notNull().toString()); 29 new ArgumentError.notNull().toString());
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 new RangeError.index(42, [1, 2, 3], 68 new RangeError.index(42, [1, 2, 3],
65 null, "message").toString()); 69 null, "message").toString());
66 Expect.equals("RangeError (foo): message: " 70 Expect.equals("RangeError (foo): message: "
67 "index should be less than 2: 42", 71 "index should be less than 2: 42",
68 new RangeError.index(42, [1, 2, 3], 72 new RangeError.index(42, [1, 2, 3],
69 "foo", "message", 2).toString()); 73 "foo", "message", 2).toString());
70 Expect.equals("RangeError: Index out of range: " 74 Expect.equals("RangeError: Index out of range: "
71 "index must not be negative: -5", 75 "index must not be negative: -5",
72 new RangeError.index(-5, [1, 2, 3]).toString()); 76 new RangeError.index(-5, [1, 2, 3]).toString());
73 } 77 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698