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 /// Tests that run the checker end-to-end using the file system, but with a mock | 5 /// Tests that run the checker end-to-end using the file system, but with a mock |
6 /// SDK. | 6 /// SDK. |
7 library ddc.test.end_to_end; | 7 library ddc.test.end_to_end; |
8 | 8 |
9 import 'dart:io'; | 9 import 'dart:io'; |
10 import 'package:dev_compiler/devc.dart' show compile; | 10 import 'package:dev_compiler/devc.dart' show Compiler; |
11 import 'package:dev_compiler/src/checker/dart_sdk.dart' show mockSdkSources; | |
12 import 'package:dev_compiler/src/checker/resolver.dart' show TypeResolver; | |
13 import 'package:dev_compiler/src/options.dart'; | 11 import 'package:dev_compiler/src/options.dart'; |
14 import 'package:dev_compiler/src/report.dart'; | 12 import 'package:dev_compiler/src/report.dart'; |
15 import 'package:path/path.dart' as path; | 13 import 'package:path/path.dart' as path; |
16 import 'package:unittest/unittest.dart'; | 14 import 'package:unittest/unittest.dart'; |
17 | 15 |
18 main() { | 16 main() { |
19 var options = new CompilerOptions(); | |
20 var mockSdk = new TypeResolver.fromMock(mockSdkSources, options); | |
21 | |
22 var testDir = path.absolute(path.dirname(Platform.script.path)); | 17 var testDir = path.absolute(path.dirname(Platform.script.path)); |
23 | |
24 _check(testfile) { | 18 _check(testfile) { |
25 compile('$testDir/$testfile.dart', mockSdk, options, new LogReporter()); | 19 var options = new CompilerOptions( |
| 20 entryPointFile: '$testDir/$testfile.dart', useMockSdk: true); |
| 21 new Compiler(options).run(); |
26 } | 22 } |
27 | 23 |
28 test('checker runs correctly (end-to-end)', () { | 24 test('checker runs correctly (end-to-end)', () { |
29 _check('samples/funwithtypes'); | 25 _check('samples/funwithtypes'); |
30 }); | 26 }); |
31 | 27 |
32 test('checker accepts files with imports', () { | 28 test('checker accepts files with imports', () { |
33 _check('samples/import_test'); | 29 _check('samples/import_test'); |
34 }); | 30 }); |
35 | 31 |
36 test('checker tests function types', () { | 32 test('checker tests function types', () { |
37 // TODO(vsm): Check for correct down casts. | 33 // TODO(vsm): Check for correct down casts. |
38 _check('samples/function_type_test'); | 34 _check('samples/function_type_test'); |
39 }); | 35 }); |
40 | 36 |
41 test('checker tests runtime checks', () { | 37 test('checker tests runtime checks', () { |
42 // TODO(sigmund,vsm): Check output for invalid checks. | 38 // TODO(sigmund,vsm): Check output for invalid checks. |
43 _check('samples/runtimetypechecktest'); | 39 _check('samples/runtimetypechecktest'); |
44 }); | 40 }); |
45 | 41 |
46 test('checker tests return values', () { | 42 test('checker tests return values', () { |
47 // TODO(vsm): Check for conversions. | 43 // TODO(vsm): Check for conversions. |
48 _check('samples/return_test'); | 44 _check('samples/return_test'); |
49 }); | 45 }); |
50 } | 46 } |
OLD | NEW |