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