From 1fb2158e3672a4b4e58d8bd883134aa931e07090 Mon Sep 17 00:00:00 2001 From: Shibata Ryusei <103942785+ShibataRyusei@users.noreply.github.com> Date: Sun, 26 Mar 2023 20:10:23 +0900 Subject: [PATCH] Add lints test for all templates (#120526) Add lints test for all templates --- .../analyze_all_templates_test.dart | 45 +++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 packages/flutter_tools/test/integration.shard/analyze_all_templates_test.dart diff --git a/packages/flutter_tools/test/integration.shard/analyze_all_templates_test.dart b/packages/flutter_tools/test/integration.shard/analyze_all_templates_test.dart new file mode 100644 index 00000000000..d29c835123c --- /dev/null +++ b/packages/flutter_tools/test/integration.shard/analyze_all_templates_test.dart @@ -0,0 +1,45 @@ +// 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 'package:flutter_tools/src/globals.dart' as globals; + +import '../src/common.dart'; +import '../src/context.dart'; +import '../src/test_flutter_command_runner.dart'; + +void main() { + group('pass analyze template:', () { + final List templates = [ + 'app', + 'module', + 'package', + 'plugin', + 'plugin_ffi', + 'skeleton', + ]; + late Directory tempDir; + + setUp(() { + tempDir = globals.fs.systemTempDirectory + .createTempSync('flutter_tools_analyze_all_template.'); + }); + + tearDown(() { + tryToDelete(tempDir); + }); + + for (final String template in templates) { + testUsingContext('analysis for $template', () async { + final String projectPath = await createProject(tempDir, + arguments: ['--no-pub', '--template', template]); + final ProcessResult result = await globals.processManager + .run(['flutter', 'analyze'], workingDirectory: projectPath); + + expect(result.exitCode, 0); + }); + } + }); +}