analyzer etc: move analysisOptionsContent function to be shared
This function was defined once in analyzer testing code, once in linter testing code, and once in analysis_server testing code. In this change, all three are combined into one function in analyzer_utilities. Change-Id: Ib2daa7b3d14aae6ca2aa09f6f9bdeaf76bc72d10 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423068 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>
This commit is contained in:
committed by
Commit Queue
parent
94d06474d2
commit
5eef8e4ebe
@@ -21,6 +21,7 @@ import 'package:analyzer/src/test_utilities/test_code_format.dart';
|
||||
import 'package:analyzer/src/util/file_paths.dart' as file_paths;
|
||||
import 'package:analyzer_utilities/test/experiments/experiments.dart';
|
||||
import 'package:analyzer_utilities/test/mock_packages/mock_packages.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:unified_analytics/unified_analytics.dart';
|
||||
@@ -30,44 +31,6 @@ import 'mocks.dart';
|
||||
import 'support/configuration_files.dart';
|
||||
import 'utils/message_scheduler_test_view.dart';
|
||||
|
||||
// TODO(scheglov): This is duplicate with pkg/linter/test/rule_test_support.dart.
|
||||
// Keep them as consistent with each other as they are today. Ultimately combine
|
||||
// them in a shared analyzer test utilities package (e.g. the analyzer_utilities
|
||||
// package).
|
||||
String analysisOptionsContent({
|
||||
String? include,
|
||||
List<String> experiments = const [],
|
||||
List<String> plugins = const [],
|
||||
List<String> rules = const [],
|
||||
}) {
|
||||
var buffer = StringBuffer();
|
||||
|
||||
if (include != null) {
|
||||
buffer.writeln('include: $include');
|
||||
}
|
||||
buffer.writeln('analyzer:');
|
||||
if (experiments.isNotEmpty) {
|
||||
buffer.writeln(' enable-experiment:');
|
||||
for (var experiment in experiments) {
|
||||
buffer.writeln(' - $experiment');
|
||||
}
|
||||
}
|
||||
if (plugins.isNotEmpty) {
|
||||
buffer.writeln(' plugins:');
|
||||
for (var plugin in plugins) {
|
||||
buffer.writeln(' - $plugin');
|
||||
}
|
||||
}
|
||||
|
||||
buffer.writeln('linter:');
|
||||
buffer.writeln(' rules:');
|
||||
for (var rule in rules) {
|
||||
buffer.writeln(' - $rule');
|
||||
}
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
class BlazeWorkspaceAnalysisServerTest extends ContextResolutionTest {
|
||||
String get myPackageLibPath => '$myPackageRootPath/lib';
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import 'package:analyzer/src/util/file_paths.dart' as file_paths;
|
||||
import 'package:analyzer/src/utilities/extensions/file_system.dart';
|
||||
import 'package:analyzer_plugin/protocol/protocol_common.dart';
|
||||
import 'package:analyzer_plugin/protocol/protocol_generated.dart' as plugin;
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:analyzer_utilities/testing/tree_string_sink.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:test/test.dart';
|
||||
@@ -2170,7 +2171,10 @@ class SetAnalysisRootsTest extends PubPackageAnalysisServerTest {
|
||||
// nestedFolder1 has plugin2 enabled.
|
||||
newAnalysisOptionsYamlFile(
|
||||
join(workspaceRootPath, 'package1', 'nestedFolder1'),
|
||||
analysisOptionsContent(experiments: experiments, plugins: [plugin2.name]),
|
||||
analysisOptionsContent(
|
||||
experiments: experiments,
|
||||
legacyPlugins: [plugin2.name],
|
||||
),
|
||||
);
|
||||
|
||||
// Write the single package config at the root that can resolve both
|
||||
@@ -2213,7 +2217,10 @@ class SetAnalysisRootsTest extends PubPackageAnalysisServerTest {
|
||||
// nestedFolder1 also has plugin1 enabled.
|
||||
newAnalysisOptionsYamlFile(
|
||||
join(workspaceRootPath, 'package1', 'nestedFolder1'),
|
||||
analysisOptionsContent(experiments: experiments, plugins: [plugin1.name]),
|
||||
analysisOptionsContent(
|
||||
experiments: experiments,
|
||||
legacyPlugins: [plugin1.name],
|
||||
),
|
||||
);
|
||||
|
||||
// Write the single package config at the root that can resolve both
|
||||
@@ -2449,7 +2456,7 @@ class SetAnalysisRootsTest extends PubPackageAnalysisServerTest {
|
||||
packagePath,
|
||||
analysisOptionsContent(
|
||||
experiments: experiments,
|
||||
plugins: plugins.map((plugin) => plugin.name).toList(),
|
||||
legacyPlugins: plugins.map((plugin) => plugin.name).toList(),
|
||||
),
|
||||
);
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
|
||||
import 'package:analysis_server/protocol/protocol_generated.dart';
|
||||
import 'package:analyzer_plugin/protocol/protocol_common.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:linter/src/lint_names.dart';
|
||||
import 'package:linter/src/rules.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
@@ -14,11 +14,11 @@ import 'package:analyzer/file_system/physical_file_system.dart';
|
||||
import 'package:analyzer/src/util/file_paths.dart' as file_paths;
|
||||
import 'package:analyzer_plugin/protocol/protocol_common.dart';
|
||||
import 'package:analyzer_utilities/test/mock_packages/mock_packages.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
import 'package:path/path.dart' as path;
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import '../../analysis_server_base.dart' show analysisOptionsContent;
|
||||
import '../../support/configuration_files.dart';
|
||||
import '../../support/sdk_paths.dart';
|
||||
import 'integration_test_methods.dart';
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. 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:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:linter/src/lint_names.dart';
|
||||
import 'package:linter/src/rules.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../../../../analysis_server_base.dart';
|
||||
import '../../../../client/completion_driver_test.dart';
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -4,12 +4,12 @@
|
||||
|
||||
import 'package:analysis_server/src/services/correction/sort_members.dart';
|
||||
import 'package:analyzer_plugin/protocol/protocol_common.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:linter/src/lint_names.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../../abstract_single_unit.dart';
|
||||
import '../../analysis_server_base.dart';
|
||||
|
||||
void main() {
|
||||
defineReflectiveSuite(() {
|
||||
|
||||
@@ -6,12 +6,12 @@ import 'package:analysis_server/src/services/refactoring/legacy/extract_method.d
|
||||
import 'package:analyzer/source/source.dart';
|
||||
import 'package:analyzer_plugin/protocol/protocol_common.dart';
|
||||
import 'package:analyzer_plugin/src/utilities/string_utilities.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:linter/src/rules.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../../../abstract_single_unit.dart';
|
||||
import '../../../analysis_server_base.dart';
|
||||
import 'abstract_refactoring.dart';
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -6,12 +6,12 @@ import 'package:analysis_server/protocol/protocol_generated.dart';
|
||||
import 'package:analysis_server/src/computer/import_elements_computer.dart';
|
||||
import 'package:analyzer/src/test_utilities/package_config_file_builder.dart';
|
||||
import 'package:analyzer_plugin/protocol/protocol_common.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:linter/src/rules.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../../abstract_context.dart';
|
||||
import '../../analysis_server_base.dart';
|
||||
|
||||
void main() {
|
||||
defineReflectiveSuite(() {
|
||||
|
||||
+1
-1
@@ -4,9 +4,9 @@
|
||||
|
||||
import 'package:analysis_server/src/services/correction/fix.dart';
|
||||
import 'package:analyzer_plugin/utilities/fixes/fixes.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../../../../analysis_server_base.dart';
|
||||
import 'fix_processor.dart';
|
||||
|
||||
void main() {
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:linter/src/lint_codes.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
|
||||
@@ -21,11 +21,10 @@ import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
|
||||
import 'package:analyzer/src/util/file_paths.dart' as file_paths;
|
||||
import 'package:analyzer/src/workspace/basic.dart';
|
||||
import 'package:analyzer/src/workspace/blaze.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../resolution/context_collection_resolution.dart';
|
||||
|
||||
main() {
|
||||
defineReflectiveSuite(() {
|
||||
defineReflectiveTests(ContextBuilderImplTest);
|
||||
|
||||
@@ -10,6 +10,7 @@ import 'package:analyzer/error/error.dart';
|
||||
import 'package:analyzer/file_system/file_system.dart';
|
||||
import 'package:analyzer/src/dart/analysis/driver.dart';
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ import 'package:analyzer/src/fine/requirements.dart';
|
||||
import 'package:analyzer/src/lint/linter.dart';
|
||||
import 'package:analyzer/src/test_utilities/lint_registration_mixin.dart';
|
||||
import 'package:analyzer/src/utilities/extensions/async.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:analyzer_utilities/testing/tree_string_sink.dart';
|
||||
import 'package:linter/src/rules.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
@@ -25,6 +25,7 @@ import 'package:analyzer/src/workspace/gn.dart';
|
||||
import 'package:analyzer/src/workspace/pub.dart';
|
||||
import 'package:analyzer_utilities/test/experiments/experiments.dart';
|
||||
import 'package:analyzer_utilities/test/mock_packages/mock_packages.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:analyzer_utilities/testing/tree_string_sink.dart';
|
||||
import 'package:linter/src/rules.dart';
|
||||
import 'package:meta/meta.dart';
|
||||
@@ -37,55 +38,6 @@ import 'resolution.dart';
|
||||
|
||||
export 'package:analyzer/src/test_utilities/package_config_file_builder.dart';
|
||||
|
||||
// TODO(srawlins): This is duplicate with pkg/linter/test/rule_test_support.dart
|
||||
// and pkg/analysis_server/test/analysis_server_base.dart.
|
||||
// Keep them as consistent with each other as they are today. Ultimately combine
|
||||
// them in a shared analyzer test utilities package (e.g. the analyzer_utilities
|
||||
// package).
|
||||
String analysisOptionsContent({
|
||||
List<String> experiments = const [],
|
||||
List<String> plugins = const [],
|
||||
List<String> rules = const [],
|
||||
bool strictCasts = false,
|
||||
bool strictInference = false,
|
||||
bool strictRawTypes = false,
|
||||
List<String> unignorableNames = const [],
|
||||
}) {
|
||||
var buffer = StringBuffer();
|
||||
|
||||
buffer.writeln('analyzer:');
|
||||
if (experiments.isNotEmpty) {
|
||||
buffer.writeln(' enable-experiment:');
|
||||
for (var experiment in experiments) {
|
||||
buffer.writeln(' - $experiment');
|
||||
}
|
||||
}
|
||||
|
||||
buffer.writeln(' language:');
|
||||
buffer.writeln(' strict-casts: $strictCasts');
|
||||
buffer.writeln(' strict-inference: $strictInference');
|
||||
buffer.writeln(' strict-raw-types: $strictRawTypes');
|
||||
buffer.writeln(' cannot-ignore:');
|
||||
for (var name in unignorableNames) {
|
||||
buffer.writeln(' - $name');
|
||||
}
|
||||
|
||||
if (plugins.isNotEmpty) {
|
||||
buffer.writeln(' plugins:');
|
||||
for (var plugin in plugins) {
|
||||
buffer.writeln(' - $plugin');
|
||||
}
|
||||
}
|
||||
|
||||
buffer.writeln('linter:');
|
||||
buffer.writeln(' rules:');
|
||||
for (var rule in rules) {
|
||||
buffer.writeln(' - $rule');
|
||||
}
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
// TODO(scheglov): This is duplicate with
|
||||
// pkg/linter/test/rule_test_support.dart. Keep them as consistent with each
|
||||
// other as they are today. Ultimately combine them in a shared analyzer test
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../dart/resolution/context_collection_resolution.dart';
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../dart/resolution/context_collection_resolution.dart';
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../dart/resolution/context_collection_resolution.dart';
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../dart/resolution/context_collection_resolution.dart';
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../dart/resolution/context_collection_resolution.dart';
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
|
||||
+1
@@ -3,6 +3,7 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../dart/resolution/context_collection_resolution.dart';
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../dart/resolution/context_collection_resolution.dart';
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../dart/resolution/context_collection_resolution.dart';
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../dart/resolution/context_collection_resolution.dart';
|
||||
|
||||
@@ -7,6 +7,7 @@ import 'package:analyzer/dart/ast/visitor.dart';
|
||||
import 'package:analyzer/src/error/codes.dart';
|
||||
import 'package:analyzer/src/lint/linter.dart';
|
||||
import 'package:analyzer/src/test_utilities/lint_registration_mixin.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../dart/resolution/context_collection_resolution.dart';
|
||||
|
||||
@@ -3,10 +3,10 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analyzer/dart/element/type.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../../dart/resolution/context_collection_resolution.dart';
|
||||
import '../../dart/resolution/node_text_expectations.dart';
|
||||
import '../elements_base.dart';
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
import 'package:analyzer/error/error.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:test/test.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
// Copyright (c) 2025, the Dart project authors. Please see the AUTHORS file
|
||||
// for details. All rights reserved. Use of this source code is governed by a
|
||||
// BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
/// Returns the content for an analysis options file, specified appropriately
|
||||
/// with the given parameter values.
|
||||
String analysisOptionsContent({
|
||||
// TODO(srawlins): Change this maybe to a List<String>.
|
||||
String? include,
|
||||
List<String> experiments = const [],
|
||||
List<String> legacyPlugins = const [],
|
||||
List<String> rules = const [],
|
||||
bool strictCasts = false,
|
||||
bool strictInference = false,
|
||||
bool strictRawTypes = false,
|
||||
List<String> unignorableNames = const [],
|
||||
}) {
|
||||
var buffer = StringBuffer();
|
||||
|
||||
if (include != null) {
|
||||
buffer.writeln('include: $include');
|
||||
}
|
||||
|
||||
buffer.writeln('analyzer:');
|
||||
if (experiments.isNotEmpty) {
|
||||
buffer.writeln(' enable-experiment:');
|
||||
for (var experiment in experiments) {
|
||||
buffer.writeln(' - $experiment');
|
||||
}
|
||||
}
|
||||
|
||||
buffer.writeln(' language:');
|
||||
buffer.writeln(' strict-casts: $strictCasts');
|
||||
buffer.writeln(' strict-inference: $strictInference');
|
||||
buffer.writeln(' strict-raw-types: $strictRawTypes');
|
||||
if (unignorableNames.isNotEmpty) {
|
||||
buffer.writeln(' cannot-ignore:');
|
||||
for (var name in unignorableNames) {
|
||||
buffer.writeln(' - $name');
|
||||
}
|
||||
}
|
||||
|
||||
if (legacyPlugins.isNotEmpty) {
|
||||
buffer.writeln(' plugins:');
|
||||
for (var plugin in legacyPlugins) {
|
||||
buffer.writeln(' - $plugin');
|
||||
}
|
||||
}
|
||||
|
||||
buffer.writeln('linter:');
|
||||
buffer.writeln(' rules:');
|
||||
for (var rule in rules) {
|
||||
buffer.writeln(' - $rule');
|
||||
}
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import 'package:analyzer/src/test_utilities/package_config_file_builder.dart';
|
||||
import 'package:analyzer/src/test_utilities/resource_provider_mixin.dart';
|
||||
import 'package:analyzer_utilities/test/experiments/experiments.dart';
|
||||
import 'package:analyzer_utilities/test/mock_packages/mock_packages.dart';
|
||||
import 'package:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:linter/src/analyzer.dart';
|
||||
import 'package:linter/src/rules.dart';
|
||||
@@ -33,35 +34,6 @@ export 'package:analyzer/src/error/codes.dart';
|
||||
export 'package:analyzer/src/test_utilities/package_config_file_builder.dart';
|
||||
export 'package:linter/src/lint_names.dart';
|
||||
|
||||
// TODO(srawlins): This is duplicate with
|
||||
// pkg/analyzer/test/src/dart/resolution/context_collection_resolution.dart and
|
||||
// and pkg/analysis_server/test/analysis_server_base.dart. Keep them as
|
||||
// consistent with each other as they are today. Ultimately combine them in a
|
||||
// shared analyzer test utilities package.
|
||||
String analysisOptionsContent({
|
||||
List<String> experiments = const [],
|
||||
List<String> rules = const [],
|
||||
}) {
|
||||
var buffer = StringBuffer();
|
||||
|
||||
buffer.writeln('analyzer:');
|
||||
buffer.writeln(' enable-experiment:');
|
||||
for (var experiment in experiments) {
|
||||
buffer.writeln(' - $experiment');
|
||||
}
|
||||
|
||||
buffer.writeln(' optional-checks:');
|
||||
buffer.writeln(' propagate-linter-exceptions: true');
|
||||
|
||||
buffer.writeln('linter:');
|
||||
buffer.writeln(' rules:');
|
||||
for (var rule in rules) {
|
||||
buffer.writeln(' - $rule');
|
||||
}
|
||||
|
||||
return buffer.toString();
|
||||
}
|
||||
|
||||
ExpectedDiagnostic error(
|
||||
ErrorCode code,
|
||||
int offset,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// for details. 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:analyzer_utilities/testing/test_support.dart';
|
||||
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
||||
|
||||
import '../rule_test_support.dart';
|
||||
|
||||
Reference in New Issue
Block a user