Files
sdk/pkg/api_summary/test/test_utils.dart
T
kevmoo a2055fbb82 pkg:api_summary
- Moved existing summary logic to the new package

Change-Id: I47d032f5a253cfa32d9b685d9ff18bb08f534177
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/499440
Commit-Queue: Vijay Menon <vsm@google.com>
Auto-Submit: Kevin Moore <kevmoo@google.com>
Reviewed-by: Vijay Menon <vsm@google.com>
2026-05-01 11:29:56 -07:00

27 lines
1007 B
Dart

// Copyright (c) 2026, 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/dart/element/element.dart';
import 'package:analyzer/diagnostic/diagnostic.dart';
// TODO(paulberry): move pub_package_resolution.dart out of src
import 'package:analyzer_testing/src/analysis_rule/pub_package_resolution.dart';
import 'package:test/test.dart';
class ApiSummaryTest extends PubPackageResolutionTest {
Future<LibraryElement> analyzeLibrary(
String content, {
String pathWithinLib = 'test.dart',
}) async {
var file = newFile('$testPackageLibPath/$pathWithinLib', content);
var resolvedUnitResult = await resolveFile(file.path);
expect(
resolvedUnitResult.diagnostics.where(
(diagnostic) => diagnostic.severity == Severity.error,
),
isEmpty,
);
return resolvedUnitResult.libraryElement;
}
}