| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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:async_helper/async_helper.dart'; | 6 import 'package:async_helper/async_helper.dart'; |
| 7 import 'package:expect/expect.dart'; | 7 import 'package:expect/expect.dart'; |
| 8 import 'compiler_helper.dart'; | 8 import 'compiler_helper.dart'; |
| 9 | 9 |
| 10 const String TEST_1 = r""" | 10 const String TEST_1 = r""" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 '#.toLowerCase()', s); | 50 '#.toLowerCase()', s); |
| 51 var s2 = JS('returns:String;depends:none;effects:none;throws:null(1)', | 51 var s2 = JS('returns:String;depends:none;effects:none;throws:null(1)', |
| 52 '#.toUpperCase()', s); | 52 '#.toUpperCase()', s); |
| 53 print(s2); | 53 print(s2); |
| 54 | 54 |
| 55 // absent: 'toLowerCase' - removed since s.toUpperCase() generates the same | 55 // absent: 'toLowerCase' - removed since s.toUpperCase() generates the same |
| 56 // noSuchMethod. | 56 // noSuchMethod. |
| 57 } | 57 } |
| 58 """; | 58 """; |
| 59 | 59 |
| 60 | |
| 61 main() { | 60 main() { |
| 62 RegExp directivePattern = new RegExp( | 61 RegExp directivePattern = new RegExp( |
| 63 // \1 \2 \3 | 62 // \1 \2 \3 |
| 64 r'''// *(present|absent): (?:"([^"]*)"|'([^'']*)')''', | 63 r'''// *(present|absent): (?:"([^"]*)"|'([^'']*)')''', |
| 65 multiLine: true); | 64 multiLine: true); |
| 66 | 65 |
| 67 Future check(String test) { | 66 Future check(String test) { |
| 68 Uri uri = new Uri(scheme: 'dart', path: 'test'); | 67 Uri uri = new Uri(scheme: 'dart', path: 'test'); |
| 69 var compiler = compilerFor(test, uri, expectedErrors: 0); | 68 var compiler = compilerFor(test, uri, expectedErrors: 0); |
| 70 return compiler.run(uri).then((_) { | 69 return compiler.run(uri).then((_) { |
| (...skipping 10 matching lines...) Expand all Loading... |
| 81 } else { | 80 } else { |
| 82 assert(directive == 'absent'); | 81 assert(directive == 'absent'); |
| 83 Expect.isFalse(generated.contains(pattern), | 82 Expect.isFalse(generated.contains(pattern), |
| 84 "Must not find '$pattern' in:\n$generated"); | 83 "Must not find '$pattern' in:\n$generated"); |
| 85 } | 84 } |
| 86 } | 85 } |
| 87 }); | 86 }); |
| 88 } | 87 } |
| 89 | 88 |
| 90 asyncTest(() => Future.wait([ | 89 asyncTest(() => Future.wait([ |
| 91 check(TEST_1), | 90 check(TEST_1), |
| 92 check(TEST_2), | 91 check(TEST_2), |
| 93 check(TEST_3), | 92 check(TEST_3), |
| 94 ])); | 93 ])); |
| 95 } | 94 } |
| OLD | NEW |