| 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 | 4 |
| 5 // Tests for basic functionality. | 5 // Tests for basic functionality. |
| 6 | 6 |
| 7 library basic_tests; | 7 library basic_tests; |
| 8 | 8 |
| 9 import 'js_backend_cps_ir.dart'; | 9 import 'js_backend_cps_ir.dart'; |
| 10 | 10 |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 a = b; | 70 a = b; |
| 71 b = t; | 71 b = t; |
| 72 print(a); | 72 print(a); |
| 73 print(b); | 73 print(b); |
| 74 print(b); | 74 print(b); |
| 75 print(foo(a)); | 75 print(foo(a)); |
| 76 } | 76 } |
| 77 """, | 77 """, |
| 78 """ | 78 """ |
| 79 function() { | 79 function() { |
| 80 var a = 10, b = 1; | 80 P.print(1); |
| 81 P.print(b); | 81 P.print(10); |
| 82 P.print(a); | 82 P.print(10); |
| 83 P.print(a); | 83 P.print(V.foo(1)); |
| 84 P.print(V.foo(b)); | |
| 85 }"""), | 84 }"""), |
| 86 const TestEntry( | 85 const TestEntry( |
| 87 """ | 86 """ |
| 88 foo() { print(42); return 42; } | 87 foo() { print(42); return 42; } |
| 89 main() { return foo(); } | 88 main() { return foo(); } |
| 90 """, | 89 """, |
| 91 """function() { | 90 """function() { |
| 92 return V.foo(); | 91 return V.foo(); |
| 93 }"""), | 92 }"""), |
| 94 const TestEntry("main() {}"), | 93 const TestEntry("main() {}"), |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 """, r""" | 141 """, r""" |
| 143 function() { | 142 function() { |
| 144 V.foo(); | 143 V.foo(); |
| 145 }"""), | 144 }"""), |
| 146 // Static setters | 145 // Static setters |
| 147 const TestEntry(""" | 146 const TestEntry(""" |
| 148 var foo = 0; | 147 var foo = 0; |
| 149 main() { print(foo = 42); } | 148 main() { print(foo = 42); } |
| 150 """, r""" | 149 """, r""" |
| 151 function() { | 150 function() { |
| 152 var v0 = 42; | 151 $.foo = 42; |
| 153 $.foo = v0; | 152 P.print(42); |
| 154 P.print(v0); | |
| 155 }"""), | 153 }"""), |
| 156 const TestEntry(""" | 154 const TestEntry(""" |
| 157 set foo(x) { print(x); } | 155 set foo(x) { print(x); } |
| 158 main() { foo = 42; } | 156 main() { foo = 42; } |
| 159 """, r""" | 157 """, r""" |
| 160 function() { | 158 function() { |
| 161 V.foo(42); | 159 V.foo(42); |
| 162 }"""), | 160 }"""), |
| 163 // Assert | 161 // Assert |
| 164 const TestEntry(""" | 162 const TestEntry(""" |
| 165 foo() { print('X'); } | 163 foo() { print('X'); } |
| 166 main() { | 164 main() { |
| 167 assert(true); | 165 assert(true); |
| 168 assert(false); | 166 assert(false); |
| 169 assert(foo()); | 167 assert(foo()); |
| 170 print('Done'); | 168 print('Done'); |
| 171 }""", r""" | 169 }""", r""" |
| 172 function() { | 170 function() { |
| 173 P.print("Done"); | 171 P.print("Done"); |
| 174 }""") | 172 }""") |
| 175 ]; | 173 ]; |
| 176 | 174 |
| 177 | 175 |
| 178 void main() { | 176 void main() { |
| 179 runTests(tests); | 177 runTests(tests); |
| 180 } | 178 } |
| OLD | NEW |