| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 // VMOptions=-DUSE_CPS_IR=true | 4 // VMOptions=-DUSE_CPS_IR=true |
| 5 | 5 |
| 6 // Tests for basic functionality. | 6 // Tests for basic functionality. |
| 7 | 7 |
| 8 library basic_tests; | 8 library basic_tests; |
| 9 | 9 |
| 10 import 'js_backend_cps_ir.dart'; | 10 import 'js_backend_cps_ir.dart'; |
| 11 | 11 |
| 12 const List<TestEntry> tests = const [ | 12 const List<TestEntry> tests = const [ |
| 13 const TestEntry(r""" |
| 14 main() { |
| 15 var e = 1; |
| 16 var l = [1, 2, 3]; |
| 17 var m = {'s': 1}; |
| 18 |
| 19 print('(' ')'); |
| 20 print('(${true})'); |
| 21 print('(${1})'); |
| 22 print('(${[1, 2, 3]})'); |
| 23 print('(${{'s': 1}})'); |
| 24 print('($e)'); |
| 25 print('($l)'); |
| 26 print('($m)'); |
| 27 }""",r""" |
| 28 function() { |
| 29 var e, l, m; |
| 30 e = 1; |
| 31 l = [1, 2, 3]; |
| 32 m = P.LinkedHashMap_LinkedHashMap$_literal(["s", 1]); |
| 33 P.print("()"); |
| 34 P.print("(" + true + ")"); |
| 35 P.print("(" + 1 + ")"); |
| 36 P.print("(" + H.S([1, 2, 3]) + ")"); |
| 37 P.print("(" + H.S(P.LinkedHashMap_LinkedHashMap$_literal(["s", 1])) + ")"); |
| 38 P.print("(" + H.S(e) + ")"); |
| 39 P.print("(" + H.S(l) + ")"); |
| 40 P.print("(" + H.S(m) + ")"); |
| 41 return null; |
| 42 }"""), |
| 13 const TestEntry(""" | 43 const TestEntry(""" |
| 14 foo(a, [b = "b"]) => b; | 44 foo(a, [b = "b"]) => b; |
| 15 bar(a, {b: "b", c: "c"}) => c; | 45 bar(a, {b: "b", c: "c"}) => c; |
| 16 main() { | 46 main() { |
| 17 foo(0); | 47 foo(0); |
| 18 foo(1, 2); | 48 foo(1, 2); |
| 19 bar(3); | 49 bar(3); |
| 20 bar(4, b: 5); | 50 bar(4, b: 5); |
| 21 bar(6, c: 7); | 51 bar(6, c: 7); |
| 22 bar(8, b: 9, c: 10); | 52 bar(8, b: 9, c: 10); |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 function() { | 130 function() { |
| 101 P.print(P.DateTime$now().isBefore$1(P.DateTime$now())); | 131 P.print(P.DateTime$now().isBefore$1(P.DateTime$now())); |
| 102 return null; | 132 return null; |
| 103 }"""), | 133 }"""), |
| 104 ]; | 134 ]; |
| 105 | 135 |
| 106 | 136 |
| 107 void main() { | 137 void main() { |
| 108 runTests(tests); | 138 runTests(tests); |
| 109 } | 139 } |
| OLD | NEW |