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 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 'mock_compiler.dart'; | 8 import 'mock_compiler.dart'; |
9 import 'package:compiler/src/js/js.dart' as jsAst; | 9 import 'package:compiler/src/js/js.dart' as jsAst; |
10 import 'package:compiler/src/js/js.dart' show js; | 10 import 'package:compiler/src/js/js.dart' show js; |
(...skipping 10 matching lines...) Expand all Loading... |
21 | 21 |
22 Future testError(String statement, arguments, [String expect = ""]) { | 22 Future testError(String statement, arguments, [String expect = ""]) { |
23 return new Future.sync(() { | 23 return new Future.sync(() { |
24 bool doCheck(exception) { | 24 bool doCheck(exception) { |
25 String message = '$exception'; | 25 String message = '$exception'; |
26 Expect.isTrue(message.contains(expect), '"$message" contains "$expect"'); | 26 Expect.isTrue(message.contains(expect), '"$message" contains "$expect"'); |
27 return true; | 27 return true; |
28 } | 28 } |
29 | 29 |
30 void action() { | 30 void action() { |
31 jsAst.Node node = js.statement(statement, arguments); | 31 js.statement(statement, arguments); |
32 } | 32 } |
33 | 33 |
34 Expect.throws(action, doCheck); | 34 Expect.throws(action, doCheck); |
35 }); | 35 }); |
36 } | 36 } |
37 | 37 |
38 // Function declaration and named function. | 38 // Function declaration and named function. |
39 const NAMED_FUNCTION_1 = r''' | 39 const NAMED_FUNCTION_1 = r''' |
40 function foo/*function declaration*/() { | 40 function foo/*function declaration*/() { |
41 return function harry/*named function*/() { return #; } | 41 return function harry/*named function*/() { return #; } |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 [], | 514 [], |
515 """ | 515 """ |
516 if (a) { | 516 if (a) { |
517 while (true) | 517 while (true) |
518 if (b) | 518 if (b) |
519 foo1(); | 519 foo1(); |
520 } else | 520 } else |
521 foo2();"""), | 521 foo2();"""), |
522 ])); | 522 ])); |
523 } | 523 } |
OLD | NEW |