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