mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Sources under `packages/flutter_tools/` aren't accessible to the average Flutter user by navigating through sources from their projects, so it doesn't need to be as explicitly verbose with types for readability purposes. The `always_specify_types` lint results in extremely verbose code within the tool which adds little value. This change disables `always_specify_types` in favor of a new set of lints that aim to reduce verbosity by removing obvious types while also maintaining readability in cases where variable types otherwise wouldn't be obvious: - `omit_obvious_local_variable_types` - `omit_obvious_property_types` - `specify_nonobvious_local_variable_types` - `specify_nonobvious_property_types`
68 lines
1.7 KiB
Dart
68 lines
1.7 KiB
Dart
// Copyright 2014 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:flutter_tools/src/base/io.dart';
|
|
|
|
import '../src/common.dart';
|
|
import 'test_data/project.dart';
|
|
import 'test_utils.dart';
|
|
|
|
void main() {
|
|
late Directory tempDir;
|
|
|
|
setUp(() async {
|
|
tempDir = fileSystem.systemTempDirectory.createTempSync('driver_environment_test.');
|
|
});
|
|
|
|
tearDown(() async {
|
|
tryToDelete(tempDir);
|
|
});
|
|
|
|
testWithoutContext('environment variables are passed to the drive script', () async {
|
|
final Project project = _PrintEnvironmentVariablesInTestDriverProject();
|
|
await project.setUpIn(tempDir);
|
|
|
|
final ProcessResult result = await processManager.run(
|
|
<String>[flutterBin, 'drive', '-d', 'flutter-tester'],
|
|
workingDirectory: tempDir.path,
|
|
environment: <String, String>{'FOO': 'BAR'},
|
|
);
|
|
|
|
printOnFailure('stdout: ${result.stdout}');
|
|
printOnFailure('stderr: ${result.stderr}');
|
|
expect(result.exitCode, 0);
|
|
|
|
expect(result.stdout.toString(), contains('FOO=BAR'));
|
|
});
|
|
}
|
|
|
|
final class _PrintEnvironmentVariablesInTestDriverProject extends Project {
|
|
@override
|
|
final pubspec = '''
|
|
name: test
|
|
environment:
|
|
sdk: ^3.7.0-0
|
|
|
|
dependencies:
|
|
flutter:
|
|
sdk: flutter
|
|
''';
|
|
|
|
@override
|
|
final main = r'void main() {}';
|
|
|
|
@override
|
|
Future<void> setUpIn(Directory dir) async {
|
|
await super.setUpIn(dir);
|
|
writeFile(fileSystem.path.join(dir.path, 'test_driver', 'main_test.dart'), r'''
|
|
import 'dart:io' as io;
|
|
|
|
void main() {
|
|
print('FOO=${io.Platform.environment['FOO']}');
|
|
}
|
|
''');
|
|
}
|
|
}
|