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 /** | 5 /** |
6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub | 6 * Test infrastructure for testing pub. Unlike typical unit tests, most pub |
7 * tests are integration tests that stage some stuff on the file system, run | 7 * tests are integration tests that stage some stuff on the file system, run |
8 * pub, and then validate the results. This library provides an API to build | 8 * pub, and then validate the results. This library provides an API to build |
9 * tests like that. | 9 * tests like that. |
10 */ | 10 */ |
(...skipping 860 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 /** | 871 /** |
872 * Loads the contents of the file. | 872 * Loads the contents of the file. |
873 */ | 873 */ |
874 InputStream load(List<String> path) { | 874 InputStream load(List<String> path) { |
875 if (!path.isEmpty) { | 875 if (!path.isEmpty) { |
876 var joinedPath = Strings.join(path, '/'); | 876 var joinedPath = Strings.join(path, '/'); |
877 throw "Can't load $joinedPath from within $name: not a directory."; | 877 throw "Can't load $joinedPath from within $name: not a directory."; |
878 } | 878 } |
879 | 879 |
880 var stream = new ListInputStream(); | 880 var stream = new ListInputStream(); |
881 stream.write(contents.charCodes()); | 881 stream.write(contents.charCodes); |
882 stream.markEndOfStream(); | 882 stream.markEndOfStream(); |
883 return stream; | 883 return stream; |
884 } | 884 } |
885 } | 885 } |
886 | 886 |
887 /** | 887 /** |
888 * Describes a directory and its contents. These are used both for setting up | 888 * Describes a directory and its contents. These are used both for setting up |
889 * an expected directory tree before running a test, and for validating that | 889 * an expected directory tree before running a test, and for validating that |
890 * the file system matches some expectations after running it. | 890 * the file system matches some expectations after running it. |
891 */ | 891 */ |
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 } | 1201 } |
1202 | 1202 |
1203 /** | 1203 /** |
1204 * Schedules a callback to be called after Pub is run with [runPub], even if it | 1204 * Schedules a callback to be called after Pub is run with [runPub], even if it |
1205 * fails. | 1205 * fails. |
1206 */ | 1206 */ |
1207 void _scheduleCleanup(_ScheduledEvent event) { | 1207 void _scheduleCleanup(_ScheduledEvent event) { |
1208 if (_scheduledCleanup == null) _scheduledCleanup = []; | 1208 if (_scheduledCleanup == null) _scheduledCleanup = []; |
1209 _scheduledCleanup.add(event); | 1209 _scheduledCleanup.add(event); |
1210 } | 1210 } |
OLD | NEW |