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 "package:expect/expect.dart"; | 5 import "package:expect/expect.dart"; |
6 import 'compiler_helper.dart'; | 6 import 'compiler_helper.dart'; |
7 import 'parser_helper.dart'; | 7 import 'parser_helper.dart'; |
8 | 8 |
9 void compileAndFind(String code, String name, | 9 void compileAndFind(String code, String name, |
10 check(compiler, element)) { | 10 check(compiler, element)) { |
11 Uri uri = new Uri.fromComponents(scheme: 'source'); | 11 Uri uri = new Uri(scheme: 'source'); |
12 var compiler = compilerFor(code, uri); | 12 var compiler = compilerFor(code, uri); |
13 compiler.runCompiler(uri); | 13 compiler.runCompiler(uri); |
14 var element = findElement(compiler, name); | 14 var element = findElement(compiler, name); |
15 return check(compiler, element); | 15 return check(compiler, element); |
16 } | 16 } |
17 | 17 |
18 void checkPrintType(String expression, checkType(compiler, type)) { | 18 void checkPrintType(String expression, checkType(compiler, type)) { |
19 compileAndFind( | 19 compileAndFind( |
20 'main() { print($expression); }', | 20 'main() { print($expression); }', |
21 'print', | 21 'print', |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 Expect.identical( | 96 Expect.identical( |
97 inferrer.nullType, | 97 inferrer.nullType, |
98 typesTask.getGuaranteedTypeOfElement(thirdParameter)); | 98 typesTask.getGuaranteedTypeOfElement(thirdParameter)); |
99 }); | 99 }); |
100 } | 100 } |
101 | 101 |
102 void main() { | 102 void main() { |
103 testBasicTypes(); | 103 testBasicTypes(); |
104 testOptionalParameters(); | 104 testOptionalParameters(); |
105 } | 105 } |
OLD | NEW |