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

Side by Side Diff: tests/language/src/ObjectDynamicMethodTest.dart

Issue 10248007: test rename overhaul: step 8 - language tests (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 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
« no previous file with comments | « tests/language/src/NumbersTest.dart ('k') | tests/language/src/Operator1NegativeTest.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/src/NumbersTest.dart ('k') | tests/language/src/Operator1NegativeTest.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698