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 library pub_tests; | 5 library pub_tests; |
6 | 6 |
7 import 'dart:io'; | 7 import 'dart:io'; |
8 | 8 |
9 import '../lib/src/sdk.dart' as sdk; | 9 import '../lib/src/sdk.dart' as sdk; |
10 | 10 |
11 import 'package:path/path.dart' as path; | 11 import 'package:path/path.dart' as path; |
12 import 'package:scheduled_test/scheduled_process.dart'; | 12 import 'package:scheduled_test/scheduled_process.dart'; |
13 import 'package:scheduled_test/scheduled_test.dart'; | 13 import 'package:scheduled_test/scheduled_test.dart'; |
14 import 'test_pub.dart'; | 14 import 'test_pub.dart'; |
15 | 15 |
16 main() { | 16 main() { |
17 initConfig(); | 17 initConfig(); |
18 | 18 |
19 // This test is a bit funny. | 19 // This test is a bit funny. |
20 // | 20 // |
21 // Pub parses the "version" file that gets generated and shipped with the SDK. | 21 // Pub parses the "version" file that gets generated and shipped with the SDK. |
22 // Most of the pub tests here generate a synthetic SDK directory so that we | 22 // We want to make sure that the actual version file that gets created is |
23 // can tests against a known SDK state. But we want to make sure that the | 23 // also one pub can parse. If this test fails, it means the version file's |
24 // actual version file that gets created is also one pub can parse. If this | 24 // format has changed in a way pub didn't expect. |
25 // test fails, it means the version file's format has changed in a way pub | |
26 // didn't expect. | |
27 // | 25 // |
28 // Note that this test expects to be invoked from a Dart executable that is | 26 // Note that this test expects to be invoked from a Dart executable that is |
29 // in the built SDK's "bin" directory. Note also that this invokes pub from | 27 // in the built SDK's "bin" directory. Note also that this invokes pub from |
30 // the built SDK directory, and not the live pub code directly in the repo. | 28 // the built SDK directory, and not the live pub code directly in the repo. |
31 integration('parse the real SDK "version" file', () { | 29 integration('parse the real SDK "version" file', () { |
32 // Get the path to the pub binary in the SDK. | 30 // Get the path to the pub binary in the SDK. |
33 var pubPath = path.join(sdk.rootDirectory, 'bin', | 31 var pubPath = path.join(sdk.rootDirectory, 'bin', |
34 Platform.operatingSystem == "windows" ? "pub.bat" : "pub"); | 32 Platform.operatingSystem == "windows" ? "pub.bat" : "pub"); |
35 | 33 |
36 var pub = new ScheduledProcess.start(pubPath, ['version']); | 34 var pub = new ScheduledProcess.start(pubPath, ['version']); |
37 expect(pub.nextLine(), completion(startsWith("Pub"))); | 35 expect(pub.nextLine(), completion(startsWith("Pub"))); |
38 pub.shouldExit(0); | 36 pub.shouldExit(0); |
39 }); | 37 }); |
40 } | 38 } |
OLD | NEW |