OLD | NEW |
1 dart_library.library('language/map_literal_test', null, /* Imports */[ | 1 dart_library.library('language/map_literal_test', null, /* Imports */[ |
2 'dart_sdk', | 2 'dart_sdk', |
3 'expect' | 3 'expect' |
4 ], function load__map_literal_test(exports, dart_sdk, expect) { | 4 ], function load__map_literal_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 dart = dart_sdk.dart; | 7 const dart = dart_sdk.dart; |
8 const dartx = dart_sdk.dartx; | 8 const dartx = dart_sdk.dartx; |
9 const expect$ = expect.expect; | 9 const expect$ = expect.expect; |
10 const map_literal_test = Object.create(null); | 10 const map_literal_test = Object.create(null); |
11 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); | 11 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
12 map_literal_test.MapLiteralTest = class MapLiteralTest extends core.Object { | 12 map_literal_test.MapLiteralTest = class MapLiteralTest extends core.Object { |
13 new() { | 13 new() { |
14 } | 14 } |
15 static testMain() { | 15 static testMain() { |
16 let test = new map_literal_test.MapLiteralTest(); | 16 let test = new map_literal_test.MapLiteralTest(); |
17 test.testStaticInit(); | 17 test.testStaticInit(); |
18 test.testConstInit(); | 18 test.testConstInit(); |
19 } | 19 } |
20 testStaticInit() { | 20 testStaticInit() { |
21 let testClass = new map_literal_test.StaticInit(); | 21 let testClass = new map_literal_test.StaticInit(); |
22 testClass.test(); | 22 testClass.test(); |
23 } | 23 } |
24 testConstInit() { | 24 testConstInit() { |
25 let testClass = new map_literal_test.ConstInit(); | 25 let testClass = new map_literal_test.ConstInit(); |
26 testClass.test(); | 26 testClass.test(); |
27 } | 27 } |
28 testLocalInit() { | 28 testLocalInit() { |
29 let map1 = dart.map({a: 1, b: 2}); | 29 let map1 = dart.map({a: 1, b: 2}, core.String, core.int); |
30 let map2 = dart.map({"1": 1, "2": 2}); | 30 let map2 = dart.map({"1": 1, "2": 2}, core.String, core.int); |
31 expect$.Expect.equals(1, map1[dartx.get]("a")); | 31 expect$.Expect.equals(1, map1[dartx.get]("a")); |
32 expect$.Expect.equals(2, map1[dartx.get]("b")); | 32 expect$.Expect.equals(2, map1[dartx.get]("b")); |
33 expect$.Expect.equals(1, map2[dartx.get]("1")); | 33 expect$.Expect.equals(1, map2[dartx.get]("1")); |
34 expect$.Expect.equals(2, map2[dartx.get]("2")); | 34 expect$.Expect.equals(2, map2[dartx.get]("2")); |
35 } | 35 } |
36 }; | 36 }; |
37 dart.setSignature(map_literal_test.MapLiteralTest, { | 37 dart.setSignature(map_literal_test.MapLiteralTest, { |
38 constructors: () => ({new: dart.definiteFunctionType(map_literal_test.MapLit
eralTest, [])}), | 38 constructors: () => ({new: dart.definiteFunctionType(map_literal_test.MapLit
eralTest, [])}), |
39 methods: () => ({ | 39 methods: () => ({ |
40 testStaticInit: dart.definiteFunctionType(dart.dynamic, []), | 40 testStaticInit: dart.definiteFunctionType(dart.dynamic, []), |
(...skipping 10 matching lines...) Expand all Loading... |
51 expect$.Expect.equals(1, map_literal_test.StaticInit.map1[dartx.get]("a"))
; | 51 expect$.Expect.equals(1, map_literal_test.StaticInit.map1[dartx.get]("a"))
; |
52 expect$.Expect.equals(2, map_literal_test.StaticInit.map1[dartx.get]("b"))
; | 52 expect$.Expect.equals(2, map_literal_test.StaticInit.map1[dartx.get]("b"))
; |
53 expect$.Expect.equals(1, map_literal_test.StaticInit.map2[dartx.get]("1"))
; | 53 expect$.Expect.equals(1, map_literal_test.StaticInit.map2[dartx.get]("1"))
; |
54 expect$.Expect.equals(2, map_literal_test.StaticInit.map2[dartx.get]("2"))
; | 54 expect$.Expect.equals(2, map_literal_test.StaticInit.map2[dartx.get]("2"))
; |
55 } | 55 } |
56 }; | 56 }; |
57 dart.setSignature(map_literal_test.StaticInit, { | 57 dart.setSignature(map_literal_test.StaticInit, { |
58 constructors: () => ({new: dart.definiteFunctionType(map_literal_test.Static
Init, [])}), | 58 constructors: () => ({new: dart.definiteFunctionType(map_literal_test.Static
Init, [])}), |
59 methods: () => ({test: dart.definiteFunctionType(dart.dynamic, [])}) | 59 methods: () => ({test: dart.definiteFunctionType(dart.dynamic, [])}) |
60 }); | 60 }); |
61 map_literal_test.StaticInit.map1 = dart.const(dart.map({a: 1, b: 2})); | 61 map_literal_test.StaticInit.map1 = dart.const(dart.map({a: 1, b: 2}, core.Stri
ng, core.int)); |
62 map_literal_test.StaticInit.map2 = dart.const(dart.map({"1": 1, "2": 2})); | 62 map_literal_test.StaticInit.map2 = dart.const(dart.map({"1": 1, "2": 2}, core.
String, core.int)); |
63 map_literal_test.ConstInit = class ConstInit extends core.Object { | 63 map_literal_test.ConstInit = class ConstInit extends core.Object { |
64 new() { | 64 new() { |
65 this.map1 = dart.map({a: 1, b: 2}); | 65 this.map1 = dart.map({a: 1, b: 2}, core.String, core.int); |
66 this.map2 = dart.map({"1": 1, "2": 2}); | 66 this.map2 = dart.map({"1": 1, "2": 2}, core.String, core.int); |
67 } | 67 } |
68 test() { | 68 test() { |
69 expect$.Expect.equals(1, dart.dindex(this.map1, "a")); | 69 expect$.Expect.equals(1, dart.dindex(this.map1, "a")); |
70 expect$.Expect.equals(2, dart.dindex(this.map1, "b")); | 70 expect$.Expect.equals(2, dart.dindex(this.map1, "b")); |
71 expect$.Expect.equals(1, dart.dindex(this.map2, "1")); | 71 expect$.Expect.equals(1, dart.dindex(this.map2, "1")); |
72 expect$.Expect.equals(2, dart.dindex(this.map2, "2")); | 72 expect$.Expect.equals(2, dart.dindex(this.map2, "2")); |
73 } | 73 } |
74 }; | 74 }; |
75 dart.setSignature(map_literal_test.ConstInit, { | 75 dart.setSignature(map_literal_test.ConstInit, { |
76 constructors: () => ({new: dart.definiteFunctionType(map_literal_test.ConstI
nit, [])}), | 76 constructors: () => ({new: dart.definiteFunctionType(map_literal_test.ConstI
nit, [])}), |
77 methods: () => ({test: dart.definiteFunctionType(dart.dynamic, [])}) | 77 methods: () => ({test: dart.definiteFunctionType(dart.dynamic, [])}) |
78 }); | 78 }); |
79 map_literal_test.main = function() { | 79 map_literal_test.main = function() { |
80 map_literal_test.MapLiteralTest.testMain(); | 80 map_literal_test.MapLiteralTest.testMain(); |
81 }; | 81 }; |
82 dart.fn(map_literal_test.main, VoidTodynamic()); | 82 dart.fn(map_literal_test.main, VoidTodynamic()); |
83 // Exports: | 83 // Exports: |
84 exports.map_literal_test = map_literal_test; | 84 exports.map_literal_test = map_literal_test; |
85 }); | 85 }); |
OLD | NEW |