OLD | NEW |
1 dart_library.library('corelib/map_from_iterables_test', null, /* Imports */[ | 1 dart_library.library('corelib/map_from_iterables_test', null, /* Imports */[ |
2 'dart_sdk', | 2 'dart_sdk', |
3 'expect' | 3 'expect' |
4 ], function load__map_from_iterables_test(exports, dart_sdk, expect) { | 4 ], function load__map_from_iterables_test(exports, dart_sdk, expect) { |
5 'use strict'; | 5 'use strict'; |
6 const core = dart_sdk.core; | 6 const core = dart_sdk.core; |
7 const _interceptors = dart_sdk._interceptors; | 7 const _interceptors = dart_sdk._interceptors; |
8 const collection = dart_sdk.collection; | 8 const collection = dart_sdk.collection; |
9 const dart = dart_sdk.dart; | 9 const dart = dart_sdk.dart; |
10 const dartx = dart_sdk.dartx; | 10 const dartx = dart_sdk.dartx; |
11 const expect$ = expect.expect; | 11 const expect$ = expect.expect; |
12 const map_from_iterables_test = Object.create(null); | 12 const map_from_iterables_test = Object.create(null); |
| 13 let MapOfint$String = () => (MapOfint$String = dart.constFn(core.Map$(core.int
, core.String)))(); |
13 let JSArrayOfint = () => (JSArrayOfint = dart.constFn(_interceptors.JSArray$(c
ore.int)))(); | 14 let JSArrayOfint = () => (JSArrayOfint = dart.constFn(_interceptors.JSArray$(c
ore.int)))(); |
14 let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSAr
ray$(core.String)))(); | 15 let JSArrayOfString = () => (JSArrayOfString = dart.constFn(_interceptors.JSAr
ray$(core.String)))(); |
15 let MapOfint$String = () => (MapOfint$String = dart.constFn(core.Map$(core.int
, core.String)))(); | 16 let MapOfint$int = () => (MapOfint$int = dart.constFn(core.Map$(core.int, core
.int)))(); |
16 let MapOfString$dynamic = () => (MapOfString$dynamic = dart.constFn(core.Map$(
core.String, dart.dynamic)))(); | 17 let MapOfString$dynamic = () => (MapOfString$dynamic = dart.constFn(core.Map$(
core.String, dart.dynamic)))(); |
17 let MapOfdynamic$int = () => (MapOfdynamic$int = dart.constFn(core.Map$(dart.d
ynamic, core.int)))(); | 18 let MapOfdynamic$int = () => (MapOfdynamic$int = dart.constFn(core.Map$(dart.d
ynamic, core.int)))(); |
18 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); | 19 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
19 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(da
rt.void, [])))(); | 20 let VoidTovoid = () => (VoidTovoid = dart.constFn(dart.definiteFunctionType(da
rt.void, [])))(); |
20 let VoidToMap = () => (VoidToMap = dart.constFn(dart.definiteFunctionType(core
.Map, [])))(); | 21 let VoidToMapOfint$int = () => (VoidToMapOfint$int = dart.constFn(dart.definit
eFunctionType(MapOfint$int(), [])))(); |
21 map_from_iterables_test.main = function() { | 22 map_from_iterables_test.main = function() { |
22 map_from_iterables_test.positiveTest(); | 23 map_from_iterables_test.positiveTest(); |
23 map_from_iterables_test.emptyMapTest(); | 24 map_from_iterables_test.emptyMapTest(); |
24 map_from_iterables_test.fewerKeysIterableTest(); | 25 map_from_iterables_test.fewerKeysIterableTest(); |
25 map_from_iterables_test.fewerValuesIterableTest(); | 26 map_from_iterables_test.fewerValuesIterableTest(); |
26 map_from_iterables_test.equalElementsTest(); | 27 map_from_iterables_test.equalElementsTest(); |
27 map_from_iterables_test.genericTypeTest(); | 28 map_from_iterables_test.genericTypeTest(); |
28 }; | 29 }; |
29 dart.fn(map_from_iterables_test.main, VoidTodynamic()); | 30 dart.fn(map_from_iterables_test.main, VoidTodynamic()); |
30 map_from_iterables_test.positiveTest = function() { | 31 map_from_iterables_test.positiveTest = function() { |
31 let map = core.Map.fromIterables(JSArrayOfint().of([1, 2, 3]), JSArrayOfStri
ng().of(["one", "two", "three"])); | 32 let map = MapOfint$String().fromIterables(JSArrayOfint().of([1, 2, 3]), JSAr
rayOfString().of(["one", "two", "three"])); |
32 expect$.Expect.isTrue(core.Map.is(map)); | 33 expect$.Expect.isTrue(core.Map.is(map)); |
33 expect$.Expect.isTrue(collection.LinkedHashMap.is(map)); | 34 expect$.Expect.isTrue(collection.LinkedHashMap.is(map)); |
34 expect$.Expect.equals(3, map[dartx.length]); | 35 expect$.Expect.equals(3, map[dartx.length]); |
35 expect$.Expect.equals(3, map[dartx.keys][dartx.length]); | 36 expect$.Expect.equals(3, map[dartx.keys][dartx.length]); |
36 expect$.Expect.equals(3, map[dartx.values][dartx.length]); | 37 expect$.Expect.equals(3, map[dartx.values][dartx.length]); |
37 expect$.Expect.equals("one", map[dartx.get](1)); | 38 expect$.Expect.equals("one", map[dartx.get](1)); |
38 expect$.Expect.equals("two", map[dartx.get](2)); | 39 expect$.Expect.equals("two", map[dartx.get](2)); |
39 expect$.Expect.equals("three", map[dartx.get](3)); | 40 expect$.Expect.equals("three", map[dartx.get](3)); |
40 }; | 41 }; |
41 dart.fn(map_from_iterables_test.positiveTest, VoidTovoid()); | 42 dart.fn(map_from_iterables_test.positiveTest, VoidTovoid()); |
42 map_from_iterables_test.emptyMapTest = function() { | 43 map_from_iterables_test.emptyMapTest = function() { |
43 let map = core.Map.fromIterables([], []); | 44 let map = core.Map.fromIterables([], []); |
44 expect$.Expect.isTrue(core.Map.is(map)); | 45 expect$.Expect.isTrue(core.Map.is(map)); |
45 expect$.Expect.isTrue(collection.LinkedHashMap.is(map)); | 46 expect$.Expect.isTrue(collection.LinkedHashMap.is(map)); |
46 expect$.Expect.equals(0, map[dartx.length]); | 47 expect$.Expect.equals(0, map[dartx.length]); |
47 expect$.Expect.equals(0, map[dartx.keys][dartx.length]); | 48 expect$.Expect.equals(0, map[dartx.keys][dartx.length]); |
48 expect$.Expect.equals(0, map[dartx.values][dartx.length]); | 49 expect$.Expect.equals(0, map[dartx.values][dartx.length]); |
49 }; | 50 }; |
50 dart.fn(map_from_iterables_test.emptyMapTest, VoidTovoid()); | 51 dart.fn(map_from_iterables_test.emptyMapTest, VoidTovoid()); |
51 map_from_iterables_test.fewerValuesIterableTest = function() { | 52 map_from_iterables_test.fewerValuesIterableTest = function() { |
52 expect$.Expect.throws(dart.fn(() => core.Map.fromIterables(JSArrayOfint().of
([1, 2]), JSArrayOfint().of([0])), VoidToMap())); | 53 expect$.Expect.throws(dart.fn(() => MapOfint$int().fromIterables(JSArrayOfin
t().of([1, 2]), JSArrayOfint().of([0])), VoidToMapOfint$int())); |
53 }; | 54 }; |
54 dart.fn(map_from_iterables_test.fewerValuesIterableTest, VoidTovoid()); | 55 dart.fn(map_from_iterables_test.fewerValuesIterableTest, VoidTovoid()); |
55 map_from_iterables_test.fewerKeysIterableTest = function() { | 56 map_from_iterables_test.fewerKeysIterableTest = function() { |
56 expect$.Expect.throws(dart.fn(() => core.Map.fromIterables(JSArrayOfint().of
([1]), JSArrayOfint().of([0, 2])), VoidToMap())); | 57 expect$.Expect.throws(dart.fn(() => MapOfint$int().fromIterables(JSArrayOfin
t().of([1]), JSArrayOfint().of([0, 2])), VoidToMapOfint$int())); |
57 }; | 58 }; |
58 dart.fn(map_from_iterables_test.fewerKeysIterableTest, VoidTovoid()); | 59 dart.fn(map_from_iterables_test.fewerKeysIterableTest, VoidTovoid()); |
59 map_from_iterables_test.equalElementsTest = function() { | 60 map_from_iterables_test.equalElementsTest = function() { |
60 let map = core.Map.fromIterables(JSArrayOfint().of([1, 2, 2]), JSArrayOfStri
ng().of(["one", "two", "three"])); | 61 let map = MapOfint$String().fromIterables(JSArrayOfint().of([1, 2, 2]), JSAr
rayOfString().of(["one", "two", "three"])); |
61 expect$.Expect.isTrue(core.Map.is(map)); | 62 expect$.Expect.isTrue(core.Map.is(map)); |
62 expect$.Expect.isTrue(collection.LinkedHashMap.is(map)); | 63 expect$.Expect.isTrue(collection.LinkedHashMap.is(map)); |
63 expect$.Expect.equals(2, map[dartx.length]); | 64 expect$.Expect.equals(2, map[dartx.length]); |
64 expect$.Expect.equals(2, map[dartx.keys][dartx.length]); | 65 expect$.Expect.equals(2, map[dartx.keys][dartx.length]); |
65 expect$.Expect.equals(2, map[dartx.values][dartx.length]); | 66 expect$.Expect.equals(2, map[dartx.values][dartx.length]); |
66 expect$.Expect.equals("one", map[dartx.get](1)); | 67 expect$.Expect.equals("one", map[dartx.get](1)); |
67 expect$.Expect.equals("three", map[dartx.get](2)); | 68 expect$.Expect.equals("three", map[dartx.get](2)); |
68 }; | 69 }; |
69 dart.fn(map_from_iterables_test.equalElementsTest, VoidTovoid()); | 70 dart.fn(map_from_iterables_test.equalElementsTest, VoidTovoid()); |
70 map_from_iterables_test.genericTypeTest = function() { | 71 map_from_iterables_test.genericTypeTest = function() { |
71 let map = MapOfint$String().fromIterables(JSArrayOfint().of([1, 2, 3]), JSAr
rayOfString().of(["one", "two", "three"])); | 72 let map = MapOfint$String().fromIterables(JSArrayOfint().of([1, 2, 3]), JSAr
rayOfString().of(["one", "two", "three"])); |
72 expect$.Expect.isTrue(MapOfint$String().is(map)); | 73 expect$.Expect.isTrue(MapOfint$String().is(map)); |
73 expect$.Expect.isFalse(MapOfString$dynamic().is(map)); | 74 expect$.Expect.isFalse(MapOfString$dynamic().is(map)); |
74 expect$.Expect.isFalse(MapOfdynamic$int().is(map)); | 75 expect$.Expect.isFalse(MapOfdynamic$int().is(map)); |
75 expect$.Expect.equals(3, map[dartx.length]); | 76 expect$.Expect.equals(3, map[dartx.length]); |
76 expect$.Expect.equals(3, map[dartx.keys][dartx.length]); | 77 expect$.Expect.equals(3, map[dartx.keys][dartx.length]); |
77 expect$.Expect.equals(3, map[dartx.values][dartx.length]); | 78 expect$.Expect.equals(3, map[dartx.values][dartx.length]); |
78 expect$.Expect.equals("one", map[dartx.get](1)); | 79 expect$.Expect.equals("one", map[dartx.get](1)); |
79 expect$.Expect.equals("two", map[dartx.get](2)); | 80 expect$.Expect.equals("two", map[dartx.get](2)); |
80 expect$.Expect.equals("three", map[dartx.get](3)); | 81 expect$.Expect.equals("three", map[dartx.get](3)); |
81 }; | 82 }; |
82 dart.fn(map_from_iterables_test.genericTypeTest, VoidTovoid()); | 83 dart.fn(map_from_iterables_test.genericTypeTest, VoidTovoid()); |
83 // Exports: | 84 // Exports: |
84 exports.map_from_iterables_test = map_from_iterables_test; | 85 exports.map_from_iterables_test = map_from_iterables_test; |
85 }); | 86 }); |
OLD | NEW |