OLD | NEW |
1 dart_library.library('language/string_interpolate2_test', null, /* Imports */[ | 1 dart_library.library('language/string_interpolate2_test', null, /* Imports */[ |
2 'dart_sdk', | 2 'dart_sdk', |
3 'expect' | 3 'expect' |
4 ], function load__string_interpolate2_test(exports, dart_sdk, expect) { | 4 ], function load__string_interpolate2_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 dart = dart_sdk.dart; | 8 const dart = dart_sdk.dart; |
9 const dartx = dart_sdk.dartx; | 9 const dartx = dart_sdk.dartx; |
10 const expect$ = expect.expect; | 10 const expect$ = expect.expect; |
11 const string_interpolate2_test = Object.create(null); | 11 const string_interpolate2_test = Object.create(null); |
12 let JSArrayOfint = () => (JSArrayOfint = dart.constFn(_interceptors.JSArray$(c
ore.int)))(); | 12 let JSArrayOfint = () => (JSArrayOfint = dart.constFn(_interceptors.JSArray$(c
ore.int)))(); |
13 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun
ctionType(dart.dynamic, [dart.dynamic])))(); | 13 let dynamicTodynamic = () => (dynamicTodynamic = dart.constFn(dart.definiteFun
ctionType(dart.dynamic, [dart.dynamic])))(); |
| 14 let VoidToString = () => (VoidToString = dart.constFn(dart.definiteFunctionTyp
e(core.String, [])))(); |
14 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); | 15 let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionT
ype(dart.dynamic, [])))(); |
15 let VoidToString = () => (VoidToString = dart.constFn(dart.definiteFunctionTyp
e(core.String, [])))(); | |
16 string_interpolate2_test.StringInterpolate2Test = class StringInterpolate2Test
extends core.Object { | 16 string_interpolate2_test.StringInterpolate2Test = class StringInterpolate2Test
extends core.Object { |
17 static testMain() { | 17 static testMain() { |
18 string_interpolate2_test.StringInterpolate2Test.F1 = dart.str`1 + 5 = ${1
+ 5}`; | 18 string_interpolate2_test.StringInterpolate2Test.F1 = dart.str`1 + 5 = ${1
+ 5}`; |
19 expect$.Expect.equals("1 + 5 = 6", string_interpolate2_test.StringInterpol
ate2Test.F1); | 19 expect$.Expect.equals("1 + 5 = 6", string_interpolate2_test.StringInterpol
ate2Test.F1); |
20 let fib = JSArrayOfint().of([1, 1, 2, 3, 5, 8, 13, 21]); | 20 let fib = JSArrayOfint().of([1, 1, 2, 3, 5, 8, 13, 21]); |
21 let i = 5; | 21 let i = 5; |
22 let s = dart.str`${i}`; | 22 let s = dart.str`${i}`; |
23 expect$.Expect.equals("5", s); | 23 expect$.Expect.equals("5", s); |
24 s = dart.str`fib(${i}) = ${fib[dartx.get](i)}`; | 24 s = dart.str`fib(${i}) = ${fib[dartx.get](i)}`; |
25 expect$.Expect.equals("fib(5) = 8", s); | 25 expect$.Expect.equals("fib(5) = 8", s); |
26 i = 5; | 26 i = 5; |
27 s = dart.str`${i} squared is ${dart.dcall(dart.fn(x => dart.dsend(x, '*',
x), dynamicTodynamic()), i)}`; | 27 s = dart.str`${i} squared is ${dart.fn(x => dart.dsend(x, '*', x), dynamic
Todynamic())(i)}`; |
28 expect$.Expect.equals("5 squared is 25", s); | 28 expect$.Expect.equals("5 squared is 25", s); |
29 expect$.Expect.equals("8", dart.str`${fib[dartx.length]}`); | 29 expect$.Expect.equals("8", dart.str`${fib[dartx.length]}`); |
30 expect$.Expect.equals("8", dart.str`${fib[dartx.length]}`); | 30 expect$.Expect.equals("8", dart.str`${fib[dartx.length]}`); |
31 expect$.Expect.equals("8", dart.str`${fib[dartx.length]}`); | 31 expect$.Expect.equals("8", dart.str`${fib[dartx.length]}`); |
32 let map = dart.map({red: 1, green: 2, blue: 3}, core.String, core.int); | 32 let map = dart.map({red: 1, green: 2, blue: 3}, core.String, core.int); |
33 s = dart.str`green has value ${map[dartx.get]("green")}`; | 33 s = dart.str`green has value ${map[dartx.get]("green")}`; |
34 expect$.Expect.equals("green has value 2", s); | 34 expect$.Expect.equals("green has value 2", s); |
35 i = 0; | 35 i = 0; |
36 function b() { | 36 function b() { |
37 return dart.str`${++i}`; | 37 return dart.str`${++i}`; |
38 } | 38 } |
39 dart.fn(b, VoidTodynamic()); | 39 dart.fn(b, VoidToString()); |
40 s = dart.str`aaa ${dart.str`bbb ${b()} bbb`} aaa ${b()}`; | 40 s = dart.str`aaa ${dart.str`bbb ${b()} bbb`} aaa ${b()}`; |
41 expect$.Expect.equals("aaa bbb 1 bbb aaa 2", s); | 41 expect$.Expect.equals("aaa bbb 1 bbb aaa 2", s); |
42 s = dart.str`a ${dart.fn(() => dart.str`b ${dart.fn(() => "c", VoidToStrin
g())()}`, VoidToString())()} d`; | 42 s = dart.str`a ${dart.fn(() => dart.str`b ${dart.fn(() => "c", VoidToStrin
g())()}`, VoidToString())()} d`; |
43 expect$.Expect.equals("a b c d", s); | 43 expect$.Expect.equals("a b c d", s); |
44 } | 44 } |
45 }; | 45 }; |
46 dart.setSignature(string_interpolate2_test.StringInterpolate2Test, { | 46 dart.setSignature(string_interpolate2_test.StringInterpolate2Test, { |
47 statics: () => ({testMain: dart.definiteFunctionType(dart.void, [])}), | 47 statics: () => ({testMain: dart.definiteFunctionType(dart.void, [])}), |
48 names: ['testMain'] | 48 names: ['testMain'] |
49 }); | 49 }); |
50 string_interpolate2_test.StringInterpolate2Test.F1 = null; | 50 string_interpolate2_test.StringInterpolate2Test.F1 = null; |
51 string_interpolate2_test.main = function() { | 51 string_interpolate2_test.main = function() { |
52 string_interpolate2_test.StringInterpolate2Test.testMain(); | 52 string_interpolate2_test.StringInterpolate2Test.testMain(); |
53 }; | 53 }; |
54 dart.fn(string_interpolate2_test.main, VoidTodynamic()); | 54 dart.fn(string_interpolate2_test.main, VoidTodynamic()); |
55 // Exports: | 55 // Exports: |
56 exports.string_interpolate2_test = string_interpolate2_test; | 56 exports.string_interpolate2_test = string_interpolate2_test; |
57 }); | 57 }); |
OLD | NEW |