OLD | NEW |
(Empty) | |
| 1 dart_library.library('corelib/map_keys_test', null, /* Imports */[ |
| 2 'dart_sdk', |
| 3 'expect' |
| 4 ], function load__map_keys_test(exports, dart_sdk, expect) { |
| 5 'use strict'; |
| 6 const core = dart_sdk.core; |
| 7 const dart = dart_sdk.dart; |
| 8 const dartx = dart_sdk.dartx; |
| 9 const expect$ = expect.expect; |
| 10 const map_keys_test = Object.create(null); |
| 11 let MapOfString$int = () => (MapOfString$int = dart.constFn(core.Map$(core.Str
ing, core.int)))(); |
| 12 let MapOfString$bool = () => (MapOfString$bool = dart.constFn(core.Map$(core.S
tring, core.bool)))(); |
| 13 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
| 14 let const$; |
| 15 let const$0; |
| 16 map_keys_test.main = function() { |
| 17 let map1 = dart.map({foo: 42, bar: 499}); |
| 18 let map2 = dart.map(); |
| 19 let map3 = const$ || (const$ = dart.const(dart.map({foo: 42, bar: 499}))); |
| 20 let map4 = const$0 || (const$0 = dart.const(dart.map())); |
| 21 let map5 = MapOfString$int().new(); |
| 22 map5[dartx.set]("foo", 43); |
| 23 map5[dartx.set]("bar", 500); |
| 24 let map6 = MapOfString$bool().new(); |
| 25 expect$.Expect.isTrue(core.Iterable.is(map1[dartx.keys])); |
| 26 expect$.Expect.isFalse(core.List.is(map1[dartx.keys])); |
| 27 expect$.Expect.equals(2, map1[dartx.keys][dartx.length]); |
| 28 expect$.Expect.equals("foo", map1[dartx.keys][dartx.first]); |
| 29 expect$.Expect.equals("bar", map1[dartx.keys][dartx.last]); |
| 30 expect$.Expect.isTrue(core.Iterable.is(map2[dartx.keys])); |
| 31 expect$.Expect.isFalse(core.List.is(map2[dartx.keys])); |
| 32 expect$.Expect.equals(0, map2[dartx.keys][dartx.length]); |
| 33 expect$.Expect.isTrue(core.Iterable.is(map3[dartx.keys])); |
| 34 expect$.Expect.isFalse(core.List.is(map3[dartx.keys])); |
| 35 expect$.Expect.equals(2, map3[dartx.keys][dartx.length]); |
| 36 expect$.Expect.equals("foo", map3[dartx.keys][dartx.first]); |
| 37 expect$.Expect.equals("bar", map3[dartx.keys][dartx.last]); |
| 38 expect$.Expect.isTrue(core.Iterable.is(map4[dartx.keys])); |
| 39 expect$.Expect.isFalse(core.List.is(map4[dartx.keys])); |
| 40 expect$.Expect.equals(0, map4[dartx.keys][dartx.length]); |
| 41 expect$.Expect.isTrue(core.Iterable.is(map5[dartx.keys])); |
| 42 expect$.Expect.isFalse(core.List.is(map5[dartx.keys])); |
| 43 expect$.Expect.equals(2, map5[dartx.keys][dartx.length]); |
| 44 expect$.Expect.isTrue(map5[dartx.keys][dartx.first] == "foo" || map5[dartx.k
eys][dartx.first] == "bar"); |
| 45 expect$.Expect.isTrue(map5[dartx.keys][dartx.last] == "foo" || map5[dartx.ke
ys][dartx.last] == "bar"); |
| 46 expect$.Expect.notEquals(map5[dartx.keys][dartx.first], map5[dartx.keys][dar
tx.last]); |
| 47 expect$.Expect.isTrue(core.Iterable.is(map6[dartx.keys])); |
| 48 expect$.Expect.isFalse(core.List.is(map6[dartx.keys])); |
| 49 expect$.Expect.equals(0, map6[dartx.keys][dartx.length]); |
| 50 }; |
| 51 dart.fn(map_keys_test.main, VoidTodynamic()); |
| 52 // Exports: |
| 53 exports.map_keys_test = map_keys_test; |
| 54 }); |
OLD | NEW |