| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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:path/path.dart' as p; | 5 import 'package:path/path.dart' as p; |
| 6 import 'package:scheduled_test/scheduled_test.dart'; | 6 import 'package:scheduled_test/scheduled_test.dart'; |
| 7 import 'package:scheduled_test/scheduled_stream.dart'; | 7 import 'package:scheduled_test/scheduled_stream.dart'; |
| 8 | 8 |
| 9 import '../../lib/src/exit_codes.dart' as exit_codes; | 9 import '../../lib/src/exit_codes.dart' as exit_codes; |
| 10 import '../descriptor.dart' as d; | 10 import '../descriptor.dart' as d; |
| 11 import '../test_pub.dart'; | 11 import '../test_pub.dart'; |
| 12 | 12 |
| 13 main() { | 13 main() { |
| 14 initConfig(); | 14 initConfig(); |
| 15 integration("reports Dart parse errors", () { | 15 integration("reports Dart parse errors", () { |
| 16 // Dart2js can take a long time to compile dart code, so we increase the | 16 // Dart2js can take a long time to compile dart code, so we increase the |
| 17 // timeout to cope with that. | 17 // timeout to cope with that. |
| 18 currentSchedule.timeout *= 3; | 18 currentSchedule.timeout *= 3; |
| 19 | 19 |
| 20 d.dir(appPath, [ | 20 d.dir( |
| 21 d.appPubspec(), | 21 appPath, |
| 22 d.dir('web', [ | 22 [ |
| 23 d.file('file.txt', 'contents'), | 23 d.appPubspec(), |
| 24 d.file('file.dart', 'void void;'), | 24 d.dir( |
| 25 d.dir('subdir', [ | 25 'web', |
| 26 d.file('subfile.dart', 'void void;') | 26 [ |
| 27 ]) | 27 d.file('file.txt', 'contents'), |
| 28 ]) | 28 d.file('file.dart', 'void void;'), |
| 29 ]).create(); | 29 d.dir('subdir', [d.file('subfile.dart', 'void void;')])])]).
create(); |
| 30 | 30 |
| 31 var pub = startPub(args: ["build"]); | 31 var pub = startPub(args: ["build"]); |
| 32 pub.stdout.expect(startsWith("Loading source assets...")); | 32 pub.stdout.expect(startsWith("Loading source assets...")); |
| 33 pub.stdout.expect(startsWith("Building myapp...")); | 33 pub.stdout.expect(startsWith("Building myapp...")); |
| 34 | 34 |
| 35 var consumeFile = consumeThrough(inOrder([ | 35 var consumeFile = consumeThrough( |
| 36 "[Error from Dart2JS]:", | 36 inOrder( |
| 37 startsWith(p.join("web", "file.dart") + ":") | 37 ["[Error from Dart2JS]:", startsWith(p.join("web", "file.dart") + ":
")])); |
| 38 ])); | 38 var consumeSubfile = consumeThrough( |
| 39 var consumeSubfile = consumeThrough(inOrder([ | 39 inOrder( |
| 40 "[Error from Dart2JS]:", | 40 [ |
| 41 startsWith(p.join("web", "subdir", "subfile.dart") + ":") | 41 "[Error from Dart2JS]:", |
| 42 ])); | 42 startsWith(p.join("web", "subdir", "subfile.dart") + ":")])); |
| 43 | 43 |
| 44 // It's nondeterministic what order the dart2js transformers start running, | 44 // It's nondeterministic what order the dart2js transformers start running, |
| 45 // so we allow the error messages to be emitted in either order. | 45 // so we allow the error messages to be emitted in either order. |
| 46 pub.stderr.expect(either( | 46 pub.stderr.expect( |
| 47 inOrder([consumeFile, consumeSubfile]), | 47 either( |
| 48 inOrder([consumeSubfile, consumeFile]))); | 48 inOrder([consumeFile, consumeSubfile]), |
| 49 inOrder([consumeSubfile, consumeFile]))); |
| 49 | 50 |
| 50 pub.shouldExit(exit_codes.DATA); | 51 pub.shouldExit(exit_codes.DATA); |
| 51 | 52 |
| 52 // Doesn't output anything if an error occurred. | 53 // Doesn't output anything if an error occurred. |
| 53 d.dir(appPath, [ | 54 d.dir(appPath, [d.dir('build', [d.nothing('web')])]).validate(); |
| 54 d.dir('build', [ | |
| 55 d.nothing('web') | |
| 56 ]) | |
| 57 ]).validate(); | |
| 58 }); | 55 }); |
| 59 } | 56 } |
| OLD | NEW |