| 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 /** End-to-end tests for the [Compiler] API. */ | 5 /** End-to-end tests for the [Compiler] API. */ |
| 6 library compiler_test; | 6 library compiler_test; |
| 7 | 7 |
| 8 import 'package:logging/logging.dart' show Level; | 8 import 'package:logging/logging.dart' show Level; |
| 9 import 'package:path/path.dart' as path; |
| 10 import 'package:polymer/src/messages.dart'; |
| 9 import 'package:unittest/compact_vm_config.dart'; | 11 import 'package:unittest/compact_vm_config.dart'; |
| 10 import 'package:unittest/unittest.dart'; | 12 import 'package:unittest/unittest.dart'; |
| 11 import 'package:polymer/src/messages.dart'; | |
| 12 | 13 |
| 13 import 'testing.dart'; | 14 import 'testing.dart'; |
| 14 | 15 |
| 15 main() { | 16 main() { |
| 16 useCompactVMConfiguration(); | 17 useCompactVMConfiguration(); |
| 17 | 18 |
| 18 test('recursive dependencies', () { | 19 test('recursive dependencies', () { |
| 19 var messages = new Messages.silent(); | 20 var messages = new Messages.silent(); |
| 20 var compiler = createCompiler({ | 21 var compiler = createCompiler({ |
| 21 'index.html': '<head>' | 22 'index.html': '<head>' |
| (...skipping 12 matching lines...) Expand all Loading... |
| 34 compiler.run().then(expectAsync1((e) { | 35 compiler.run().then(expectAsync1((e) { |
| 35 MockFileSystem fs = compiler.fileSystem; | 36 MockFileSystem fs = compiler.fileSystem; |
| 36 expect(fs.readCount, equals({ | 37 expect(fs.readCount, equals({ |
| 37 'index.html': 1, | 38 'index.html': 1, |
| 38 'foo.html': 1, | 39 'foo.html': 1, |
| 39 'bar.html': 1 | 40 'bar.html': 1 |
| 40 }), reason: 'Actual:\n ${fs.readCount}'); | 41 }), reason: 'Actual:\n ${fs.readCount}'); |
| 41 | 42 |
| 42 var outputs = compiler.output.map((o) => o.path); | 43 var outputs = compiler.output.map((o) => o.path); |
| 43 expect(outputs, equals([ | 44 expect(outputs, equals([ |
| 44 'out/foo.html.dart', | 45 'foo.html.dart', |
| 45 'out/foo.html.dart.map', | 46 'foo.html.dart.map', |
| 46 'out/bar.html.dart', | 47 'bar.html.dart', |
| 47 'out/bar.html.dart.map', | 48 'bar.html.dart.map', |
| 48 'out/index.html.dart', | 49 'index.html.dart', |
| 49 'out/index.html.dart.map', | 50 'index.html.dart.map', |
| 50 'out/index.html_bootstrap.dart', | 51 'index.html_bootstrap.dart', |
| 51 'out/index.html', | 52 'index.html', |
| 52 ])); | 53 ].map((p) => path.join('out', p)))); |
| 53 })); | 54 })); |
| 54 }); | 55 }); |
| 55 | 56 |
| 56 group('missing files', () { | 57 group('missing files', () { |
| 57 test('main script', () { | 58 test('main script', () { |
| 58 var messages = new Messages.silent(); | 59 var messages = new Messages.silent(); |
| 59 var compiler = createCompiler({ | 60 var compiler = createCompiler({ |
| 60 'index.html': '<head></head><body>' | 61 'index.html': '<head></head><body>' |
| 61 '<script type="application/dart" src="notfound.dart"></script>' | 62 '<script type="application/dart" src="notfound.dart"></script>' |
| 62 '</body>', | 63 '</body>', |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 MockFileSystem fs = compiler.fileSystem; | 132 MockFileSystem fs = compiler.fileSystem; |
| 132 expect(fs.readCount, | 133 expect(fs.readCount, |
| 133 { 'index.html': 1, 'foo.html': 1, 'notfound.dart': 1 }); | 134 { 'index.html': 1, 'foo.html': 1, 'notfound.dart': 1 }); |
| 134 | 135 |
| 135 var outputs = compiler.output.map((o) => o.path.toString()); | 136 var outputs = compiler.output.map((o) => o.path.toString()); |
| 136 expect(outputs, []); | 137 expect(outputs, []); |
| 137 })); | 138 })); |
| 138 }); | 139 }); |
| 139 }); | 140 }); |
| 140 } | 141 } |
| OLD | NEW |