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

Side by Side Diff: tests/language/object_dynamic_method_test.dart

Issue 10908291: Reapply "Remove Object.dynamic." (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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
« no previous file with comments | « tests/language/number_syntax_test.dart ('k') | tools/testing/dart/test_runner.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
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.
4
5 // Test that Object.dynamic returns the identical object.
6
7 main() {
8 // Primitives
9 var anInt = 5;
10 var aString = 'Hello';
11 var aBool = true;
12 var aDouble = 3.14159;
13
14 // Compounds
15 var aMap = {};
16
17 // The type should not change.
18 Expect.isTrue(dyn(anInt) is int, 'is int');
19 Expect.isTrue(dyn(aString) is String, 'is String');
20 Expect.isTrue(dyn(aBool) is bool, 'is bool');
21 Expect.isTrue(dyn(aMap) is Map, 'is Map');
22
23 // The object should be identical.
24 Expect.isTrue(eq(anInt, anInt.dynamic), 'anInt.dynamic');
25 Expect.isTrue(eq(aString, aString.dynamic), 'aString.dynamic');
26 Expect.isTrue(eq(aBool, aBool.dynamic), 'aBool.dynamic');
27 Expect.isTrue(eq(aDouble, aDouble.dynamic), 'aDouble.dynamic');
28 Expect.isTrue(eq(aMap, aMap.dynamic), 'aMap.dynamic');
29 }
30
31 dyn(x) => x.dynamic;
32
33 eq(a, b) => a === b;
OLDNEW
« no previous file with comments | « tests/language/number_syntax_test.dart ('k') | tools/testing/dart/test_runner.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698