| 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 library trydart.incremental_compilation_update_test; | 5 library trydart.incremental_compilation_update_test; |
| 6 | 6 |
| 7 import 'dart:html'; | 7 import 'dart:html'; |
| 8 | 8 |
| 9 import 'dart:async' show | 9 import 'dart:async' show |
| 10 Future; | 10 Future; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 } | 152 } |
| 153 } | 153 } |
| 154 var instance; | 154 var instance; |
| 155 main() { | 155 main() { |
| 156 if (instance == null) { | 156 if (instance == null) { |
| 157 instance = new C(); | 157 instance = new C(); |
| 158 } | 158 } |
| 159 instance.m(); | 159 instance.m(); |
| 160 } | 160 } |
| 161 """, | 161 """, |
| 162 // TODO(ahe): This test is failing, should print "v2". | 162 const <String> ['v2']), |
| 163 ], |
| 164 |
| 165 // Test that a stored instance tearoff changes behavior when updated. |
| 166 const <ProgramResult>[ |
| 167 const ProgramResult( |
| 168 """ |
| 169 class C { |
| 170 m() { |
| 171 print('v1'); |
| 172 } |
| 173 } |
| 174 var closure; |
| 175 main() { |
| 176 if (closure == null) { |
| 177 closure = new C().m; |
| 178 } |
| 179 closure(); |
| 180 } |
| 181 """, |
| 163 const <String> ['v1']), | 182 const <String> ['v1']), |
| 183 const ProgramResult( |
| 184 """ |
| 185 class C { |
| 186 m() { |
| 187 print('v2'); |
| 188 } |
| 189 } |
| 190 var closure; |
| 191 main() { |
| 192 if (closure == null) { |
| 193 closure = new C().m; |
| 194 } |
| 195 closure(); |
| 196 } |
| 197 """, |
| 198 const <String> ['v2']), |
| 164 ], | 199 ], |
| 165 ]; | 200 ]; |
| 166 | 201 |
| 167 void main() { | 202 void main() { |
| 168 listener.start(); | 203 listener.start(); |
| 169 | 204 |
| 170 return asyncTest(() => Future.forEach(tests, compileAndRun)); | 205 return asyncTest(() => Future.forEach(tests, compileAndRun)); |
| 171 } | 206 } |
| 172 | 207 |
| 173 Future compileAndRun(List<ProgramResult> programs) { | 208 Future compileAndRun(List<ProgramResult> programs) { |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 261 |
| 227 void logger(x) { | 262 void logger(x) { |
| 228 print(x); | 263 print(x); |
| 229 bool isCheckedMode = false; | 264 bool isCheckedMode = false; |
| 230 assert(isCheckedMode = true); | 265 assert(isCheckedMode = true); |
| 231 int timeout = isCheckedMode ? TIMEOUT * 2 : TIMEOUT; | 266 int timeout = isCheckedMode ? TIMEOUT * 2 : TIMEOUT; |
| 232 if (listener.elapsed > timeout) { | 267 if (listener.elapsed > timeout) { |
| 233 throw 'Test timed out.'; | 268 throw 'Test timed out.'; |
| 234 } | 269 } |
| 235 } | 270 } |
| OLD | NEW |