Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(134)

Side by Side Diff: test/test_pub.dart

Issue 1162603009: A few more fixes for testing in the repo. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « lib/src/io.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 /// Test infrastructure for testing pub. 5 /// Test infrastructure for testing pub.
6 /// 6 ///
7 /// Unlike typical unit tests, most pub tests are integration tests that stage 7 /// Unlike typical unit tests, most pub tests are integration tests that stage
8 /// some stuff on the file system, run pub, and then validate the results. This 8 /// some stuff on the file system, run pub, and then validate the results. This
9 /// library provides an API to build tests like that. 9 /// library provides an API to build tests like that.
10 library test_pub; 10 library test_pub;
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
566 var versionPath = p.join(pubRoot, '.pub', 'pub.version'); 566 var versionPath = p.join(pubRoot, '.pub', 'pub.version');
567 if (fileExists(hashPath) && fileExists(versionPath)) { 567 if (fileExists(hashPath) && fileExists(versionPath)) {
568 var oldHash = readTextFile(hashPath); 568 var oldHash = readTextFile(hashPath);
569 var oldVersion = readTextFile(versionPath); 569 var oldVersion = readTextFile(versionPath);
570 570
571 if (oldHash == hash && oldVersion == version && fileExists(snapshotPath)) { 571 if (oldHash == hash && oldVersion == version && fileExists(snapshotPath)) {
572 return; 572 return;
573 } 573 }
574 } 574 }
575 575
576 var dartSnapshot = runProcessSync(Platform.executable, [ 576 var args = ['--snapshot=$snapshotPath'];
577 '--snapshot=$snapshotPath', 577 if (Platform.packageRoot.isNotEmpty) {
578 p.join(pubRoot, 'bin', 'pub.dart') 578 args.add('--package-root=${Platform.packageRoot}');
579 ]); 579 }
580 args.add(p.join(pubRoot, 'bin', 'pub.dart'));
581
582 var dartSnapshot = runProcessSync(Platform.executable, args);
580 if (dartSnapshot.exitCode != 0) throw "Failed to run dart --snapshot."; 583 if (dartSnapshot.exitCode != 0) throw "Failed to run dart --snapshot.";
581 584
582 writeTextFile(hashPath, hash); 585 writeTextFile(hashPath, hash);
583 writeTextFile(versionPath, version); 586 writeTextFile(versionPath, version);
584 } 587 }
585 588
586 /// Returns a hash that encapsulates the current state of the repo. 589 /// Returns a hash that encapsulates the current state of the repo.
587 String _hashChanges() { 590 String _hashChanges() {
588 var hash = new SHA1(); 591 var hash = new SHA1();
589 592
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 _lastMatcher.matches(item.last, matchState); 1049 _lastMatcher.matches(item.last, matchState);
1047 } 1050 }
1048 1051
1049 Description describe(Description description) { 1052 Description describe(Description description) {
1050 return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); 1053 return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]);
1051 } 1054 }
1052 } 1055 }
1053 1056
1054 /// A [StreamMatcher] that matches multiple lines of output. 1057 /// A [StreamMatcher] that matches multiple lines of output.
1055 StreamMatcher emitsLines(String output) => inOrder(output.split("\n")); 1058 StreamMatcher emitsLines(String output) => inOrder(output.split("\n"));
OLDNEW
« no previous file with comments | « lib/src/io.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698