| 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 /// 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 import 'dart:async'; | 10 import 'dart:async'; |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 final String cachePath = "cache"; | 68 final String cachePath = "cache"; |
| 69 | 69 |
| 70 /// The path of the mock app directory used for tests, relative to the sandbox | 70 /// The path of the mock app directory used for tests, relative to the sandbox |
| 71 /// directory. | 71 /// directory. |
| 72 final String appPath = "myapp"; | 72 final String appPath = "myapp"; |
| 73 | 73 |
| 74 /// The path of the packages directory in the mock app used for tests, relative | 74 /// The path of the packages directory in the mock app used for tests, relative |
| 75 /// to the sandbox directory. | 75 /// to the sandbox directory. |
| 76 final String packagesPath = "$appPath/packages"; | 76 final String packagesPath = "$appPath/packages"; |
| 77 | 77 |
| 78 /// The path of the ".packages" file in the mock app used for tests, relative |
| 79 /// to the sandbox directory. |
| 80 final String packagesFilePath = "$appPath/.packages"; |
| 81 |
| 78 /// Set to true when the current batch of scheduled events should be aborted. | 82 /// Set to true when the current batch of scheduled events should be aborted. |
| 79 bool _abortScheduled = false; | 83 bool _abortScheduled = false; |
| 80 | 84 |
| 81 /// Enum identifying a pub command that can be run with a well-defined success | 85 /// Enum identifying a pub command that can be run with a well-defined success |
| 82 /// output. | 86 /// output. |
| 83 class RunCommand { | 87 class RunCommand { |
| 84 static final get = new RunCommand('get', new RegExp( | 88 static final get = new RunCommand('get', new RegExp( |
| 85 r'Got dependencies!|Changed \d+ dependenc(y|ies)!')); | 89 r'Got dependencies!|Changed \d+ dependenc(y|ies)!')); |
| 86 static final upgrade = new RunCommand('upgrade', new RegExp( | 90 static final upgrade = new RunCommand('upgrade', new RegExp( |
| 87 r'(No dependencies changed\.|Changed \d+ dependenc(y|ies)!)$')); | 91 r'(No dependencies changed\.|Changed \d+ dependenc(y|ies)!)$')); |
| (...skipping 679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 767 _lastMatcher.matches(item.last, matchState); | 771 _lastMatcher.matches(item.last, matchState); |
| 768 } | 772 } |
| 769 | 773 |
| 770 Description describe(Description description) { | 774 Description describe(Description description) { |
| 771 return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); | 775 return description.addAll("(", ", ", ")", [_firstMatcher, _lastMatcher]); |
| 772 } | 776 } |
| 773 } | 777 } |
| 774 | 778 |
| 775 /// A [StreamMatcher] that matches multiple lines of output. | 779 /// A [StreamMatcher] that matches multiple lines of output. |
| 776 StreamMatcher emitsLines(String output) => inOrder(output.split("\n")); | 780 StreamMatcher emitsLines(String output) => inOrder(output.split("\n")); |
| OLD | NEW |