Files
packages/script/tool/test/common/file_utils_test.dart
stuartmorgan c7e7f65108 [flutter_plugin_tool] Add support for running Windows unit tests (#4276)
Implements support for `--windows` in `native-test`, for unit tests only. The structure of the new code has most of the new functionality in a generic utility for running GoogleTest test binaries, so that it can be trivially extended to Linux support in a follow-up once the Linux test PoC has landed.

This runs the recently-added `url_launcher_windows` unit test. However, it's not yet run in CI since it needs LUCI bringup; that will be done one this support is in place.

Requires new logic to check if a plugin contains native code, and some new test utility plumbing to generate plugins whose pubspecs indicate that they only contain Dart code to test it, to allow filtering filtering out the FFI-based Windows plugins.

Part of flutter/flutter#82445
2021-08-30 11:51:58 -07:00

33 lines
1.1 KiB
Dart

// Copyright 2013 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
import 'package:file/file.dart';
import 'package:file/memory.dart';
import 'package:flutter_plugin_tools/src/common/file_utils.dart';
import 'package:test/test.dart';
void main() {
test('works on Posix', () async {
final FileSystem fileSystem =
MemoryFileSystem(style: FileSystemStyle.posix);
final Directory base = fileSystem.directory('/').childDirectory('base');
final File file =
childFileWithSubcomponents(base, <String>['foo', 'bar', 'baz.txt']);
expect(file.absolute.path, '/base/foo/bar/baz.txt');
});
test('works on Windows', () async {
final FileSystem fileSystem =
MemoryFileSystem(style: FileSystemStyle.windows);
final Directory base = fileSystem.directory(r'C:\').childDirectory('base');
final File file =
childFileWithSubcomponents(base, <String>['foo', 'bar', 'baz.txt']);
expect(file.absolute.path, r'C:\base\foo\bar\baz.txt');
});
}