Skip to content

Commit 6bf8426

Browse files
committed
Fix some tests
1 parent 71eadc5 commit 6bf8426

File tree

4 files changed

+18
-6
lines changed

4 files changed

+18
-6
lines changed

test/model_test.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ void main() {
336336
});
337337

338338
test('multiple packages, sorted default', () {
339-
expect(ginormousPackageGraph.localPackages, hasLength(4));
339+
expect(ginormousPackageGraph.localPackages, hasLength(5));
340340
expect(ginormousPackageGraph.localPackages.first.name,
341341
equals('test_package'));
342342
});
@@ -1267,7 +1267,7 @@ void main() {
12671267
});
12681268

12691269
test('correctly finds all the classes', () {
1270-
expect(classes, hasLength(28));
1270+
expect(classes, hasLength(29));
12711271
});
12721272

12731273
test('abstract', () {

test/tool_runner_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ void main() {
4545
expect(
4646
result,
4747
contains(new RegExp(
48-
r'Args: \[--file=.*[/\\]dartdoc_tools_[^/\\]+[/\\]input_\d+\]')));
48+
r'Args: \[--file=<INPUT_FILE>]')));
4949
expect(result, contains('## `TEST INPUT`'));
5050
});
5151
test('can invoke a non-Dart tool', () {

testing/test_package/bin/drill.dart

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,19 @@ void main(List<String> argList) {
1313
argParser.addOption('special');
1414
final ArgResults args = argParser.parse(argList);
1515

16-
print('Args: ${argList}');
16+
// Normalize the filename, since it includes random
17+
// and system-specific components, but make sure it
18+
// matches the pattern we expect.
19+
RegExp filenameRegExp = new RegExp(
20+
r'(--file=)(.*)([/\\]dartdoc_tools_)([^/\\]+)([/\\]input_)(\d+)');
21+
List<String> normalized = argList.map((String arg) {
22+
if (filenameRegExp.hasMatch(arg)) {
23+
return '--file=<INPUT_FILE>';
24+
} else {
25+
return arg;
26+
}
27+
}).toList();
28+
print('Args: $normalized');
1729
if (args['file'] != null) {
1830
File file = new File(args['file']);
1931
if (file.existsSync()) {
@@ -26,4 +38,4 @@ void main(List<String> argList) {
2638
}
2739
}
2840
exit(0);
29-
}
41+
}

testing/test_package_docs_dev/ex/ToolUser/invokeTool.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ <h1>invokeTool method</h1>
7272
</section>
7373
<section class="desc markdown">
7474
<p>Invokes a tool.</p>
75-
<p>Args: <code>--file=/var/folders/8m/5my4p3zj5nq4ssxv_lqpz828000r4t/T/dartdoc_tools_hKW4dC/input_1, --special= |[</code>!@#"'$%^&amp;*()_+]</p>
75+
<p>Args: <code>--file=&lt;INPUT_FILE&gt;, --special= |[</code>!@#"'$%^&amp;*()_+]</p>
7676
<h2 id="yes-it-is"><code>Yes it is!</code></h2>
7777
<h2 id="ok-fine-it-isnt"><code>Ok, fine it isn't.</code></h2>
7878
</section>

0 commit comments

Comments
 (0)