Skip to content

Commit b73bedc

Browse files
authored
Fix tests for new flutter tooling change and Dart cmd line change (#2742)
* Fix tests for new flutter tooling change and Dart cmd line change * tweak to batch file, snippets get
1 parent 3f9b02c commit b73bedc

File tree

5 files changed

+11
-9
lines changed

5 files changed

+11
-9
lines changed

lib/src/dartdoc_options.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,9 +230,9 @@ class ToolConfiguration {
230230
return isDartCommand;
231231
}
232232

233-
var executableRelatvePath = command.removeAt(0);
233+
var executableRelativePath = command.removeAt(0);
234234
var executable = pathContext.canonicalize(
235-
pathContext.join(canonicalYamlPath, executableRelatvePath));
235+
pathContext.join(canonicalYamlPath, executableRelativePath));
236236
validateExecutable(executable);
237237
if (setupCommand != null) {
238238
var setupExecutableRelativePath = setupCommand.removeAt(0);

test/tool_runner_test.dart

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import 'package:test/test.dart';
1515
import 'package:yaml/yaml.dart';
1616

1717
final Directory _testPackageDir = Directory('testing/test_package');
18+
final Directory _toolExecutableDir = Directory('testing/tool_executables');
1819

1920
void main() {
2021
ToolConfiguration toolMap;
@@ -50,10 +51,9 @@ void main() {
5051
}
5152
expect(result?.exitCode, equals(0));
5253
setupFile = File(path.join(tempDir.path, 'setup.stamp'));
53-
// We use the Dart executable for our "non-dart" tool
54-
// test, because it's the only executable that we know the
55-
// exact location of that works on all platforms.
56-
var nonDartExecutable = Platform.resolvedExecutable;
54+
var nonDartName = Platform.isWindows ? 'non_dart.bat' : 'non_dart.sh';
55+
var nonDartExecutable =
56+
path.join(_toolExecutableDir.absolute.path, nonDartName);
5757
// Have to replace backslashes on Windows with double-backslashes, to
5858
// escape them for YAML parser.
5959
var yamlMap = '''
@@ -153,7 +153,7 @@ echo:
153153
toolErrorCallback: errorCallback,
154154
);
155155
expect(errors, isEmpty);
156-
expect(result, isEmpty); // Output is on stderr.
156+
expect(result, startsWith('this is not dart'));
157157
});
158158
test('can invoke a pre-snapshotted tool', () async {
159159
var result = await runner.run(

testing/tool_executables/non_dart.bat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
@echo this is not dart

testing/tool_executables/non_dart.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
echo this is not dart

tool/grind.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -916,8 +916,7 @@ Future<List<Map>> _buildFlutterDocs(
916916
);
917917
await flutterRepo.launcher.runStreamed(
918918
flutterRepo.cachePub,
919-
['get'],
920-
workingDirectory: path.join(flutterPath, 'dev', 'snippets'),
919+
['global', 'activate', 'snippets'],
921920
);
922921
// TODO(jcollins-g): flutter's dart SDK pub tries to precompile the universe
923922
// when using -spath. Why?

0 commit comments

Comments
 (0)