| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import 'dart:async'; | 5 import 'dart:async'; |
| 6 import 'package:expect/expect.dart'; | 6 import 'package:expect/expect.dart'; |
| 7 import 'package:async_helper/async_helper.dart'; | 7 import 'package:async_helper/async_helper.dart'; |
| 8 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
| 9 | 9 |
| 10 const String FIB = r""" | 10 const String FIB = r""" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 const String TEST = r""" | 45 const String TEST = r""" |
| 46 foo(a) { | 46 foo(a) { |
| 47 if (a is !int) throw a; | 47 if (a is !int) throw a; |
| 48 if (a < 0) throw a; | 48 if (a < 0) throw a; |
| 49 return a + a; | 49 return a + a; |
| 50 } | 50 } |
| 51 """; | 51 """; |
| 52 | 52 |
| 53 main() { | 53 main() { |
| 54 asyncTest(() => Future.wait([ | 54 asyncTest(() => Future.wait([ |
| 55 // Make sure we don't introduce a new variable. | 55 // Make sure we don't introduce a new variable. |
| 56 compileAndDoNotMatch(FIB, 'fib', new RegExp("var $anyIdentifier =")), | 56 compileAndDoNotMatch(FIB, 'fib', new RegExp("var $anyIdentifier =")), |
| 57 | 57 |
| 58 compileAndDoNotMatch(BAR, 'bar', new RegExp("isLeaf")), | 58 compileAndDoNotMatch(BAR, 'bar', new RegExp("isLeaf")), |
| 59 | 59 |
| 60 compile(TEST, entry: 'foo', check: (String generated) { | 60 compile(TEST, entry: 'foo', check: (String generated) { |
| 61 Expect.isFalse(generated.contains('else')); | 61 Expect.isFalse(generated.contains('else')); |
| 62 // Regression check to ensure that there is no floating variable | 62 // Regression check to ensure that there is no floating variable |
| 63 // expression. | 63 // expression. |
| 64 Expect.isFalse(new RegExp('^[ ]*a;').hasMatch(generated)); | 64 Expect.isFalse(new RegExp('^[ ]*a;').hasMatch(generated)); |
| 65 }), | 65 }), |
| 66 ])); | 66 ])); |
| 67 } | 67 } |
| OLD | NEW |