Roll package test to 0.12.29+1 and stack_trace to 1.9.0

This required some changes to analysis_server, since analysis_server
used to have its own version of pumpEventQueue().  Since
pumpEventQueue() is now provided by the test package, I've removed
analysis_server's version, and I've updated some of the call sites to
pass in "times: 5000" to replicate the old analysis_server behavior.

This also required some changes to analyzer, since the fail() method
is now marked as @alwaysThrows, so no code may follow it without
producing a dead code hint.

Change-Id: Ie5ef3a5cc685c18da02de699e59f63f3bb8865f7
Reviewed-on: https://dart-review.googlesource.com/32683
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This commit is contained in:
Paul Berry 2018-01-06 07:23:31 -08:00 committed by commit-bot@chromium.org
parent cdd4268bc8
commit 105b170ddb
43 changed files with 107 additions and 164 deletions

4
DEPS
View file

@ -117,7 +117,7 @@ vars = {
"source_maps-0.9.4_rev": "@38524",
"source_maps_tag": "@0.10.4",
"source_span_tag": "@1.4.0",
"stack_trace_tag": "@1.8.2",
"stack_trace_tag": "@1.9.0",
"stream_channel_tag": "@1.6.2",
"string_scanner_tag": "@1.0.2",
"sunflower_rev": "@879b704933413414679396b129f5dfa96f7a0b1e",
@ -125,7 +125,7 @@ vars = {
"test_process_tag": "@1.0.1",
"term_glyph_tag": "@1.0.0",
"test_reflective_loader_tag": "@0.1.3",
"test_tag": "@0.12.24+6",
"test_tag": "@0.12.29+1",
"tuple_tag": "@v1.0.1",
"typed_data_tag": "@1.1.3",
"usage_tag": "@3.3.0",

View file

@ -14,7 +14,6 @@ import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../analysis_abstract.dart';
import '../mocks.dart';
main() {
defineReflectiveSuite(() {

View file

@ -12,7 +12,6 @@ import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../analysis_abstract.dart';
import '../mocks.dart';
main() {
defineReflectiveSuite(() {
@ -37,7 +36,7 @@ class AnalysisNotificationAnalyzedFilesTest extends AbstractAnalysisTest {
Future<Null> prepareAnalyzedFiles() async {
addGeneralAnalysisSubscription(GeneralAnalysisService.ANALYZED_FILES);
await pumpEventQueue();
await pumpEventQueue(times: 5000);
}
void processNotification(Notification notification) {

View file

@ -16,7 +16,6 @@ import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../analysis_abstract.dart';
import '../mocks.dart';
main() {
defineReflectiveSuite(() {
@ -76,7 +75,7 @@ linter:
import 'does_not_exist.dart';
''');
await waitForTasksFinished();
await pumpEventQueue();
await pumpEventQueue(times: 5000);
List<AnalysisError> errors = filesErrors[testFile];
// Verify that we are generating only 1 error for the bad URI.
// https://github.com/dart-lang/sdk/issues/23754
@ -139,7 +138,7 @@ main() {
createProject();
addTestFile('library lib');
await waitForTasksFinished();
await pumpEventQueue();
await pumpEventQueue(times: 5000);
List<AnalysisError> errors = filesErrors[testFile];
expect(errors, hasLength(1));
AnalysisError error = errors[0];
@ -192,7 +191,7 @@ main() {
}
''');
await waitForTasksFinished();
await pumpEventQueue();
await pumpEventQueue(times: 5000);
List<AnalysisError> errors = filesErrors[testFile];
expect(errors, hasLength(1));
AnalysisError error = errors[0];

View file

@ -249,44 +249,37 @@ class TestPluginManager implements PluginManager {
@override
String get byteStorePath {
fail('Unexpected invocation of byteStorePath');
return null;
}
@override
InstrumentationService get instrumentationService {
fail('Unexpected invocation of instrumentationService');
return null;
}
@override
NotificationManager get notificationManager {
fail('Unexpected invocation of notificationManager');
return null;
}
@override
List<PluginInfo> get plugins {
fail('Unexpected invocation of plugins');
return null;
}
@override
ResourceProvider get resourceProvider {
fail('Unexpected invocation of resourceProvider');
return null;
}
@override
String get sdkPath {
fail('Unexpected invocation of sdkPath');
return null;
}
@override
Future<Null> addPluginToContextRoot(
analyzer.ContextRoot contextRoot, String path) async {
fail('Unexpected invocation of addPluginToContextRoot');
return null;
}
@override
@ -306,13 +299,11 @@ class TestPluginManager implements PluginManager {
@override
List<String> pathsFor(String pluginPath) {
fail('Unexpected invocation of pathsFor');
return null;
}
@override
List<PluginInfo> pluginsForContextRoot(analyzer.ContextRoot contextRoot) {
fail('Unexpected invocation of pluginsForContextRoot');
return null;
}
@override
@ -352,6 +343,5 @@ class TestPluginManager implements PluginManager {
@override
Future<List<Null>> stopAll() async {
fail('Unexpected invocation of stopAll');
return null;
}
}

View file

@ -120,7 +120,7 @@ class AnalysisServerTest extends Object with ResourceProviderMixin {
server.setAnalysisRoots('0', ['/pkg'], [], {});
// Pump the event queue to make sure the server has finished any
// analysis.
return pumpEventQueue().then((_) {
return pumpEventQueue(times: 5000).then((_) {
List<Notification> notifications = channel.notificationsReceived;
expect(notifications, isNotEmpty);
// expect at least one notification indicating analysis is in progress

View file

@ -13,8 +13,6 @@ import 'package:mockito/mockito.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import '../mocks.dart';
main() {
defineReflectiveSuite(() {
defineReflectiveTests(ByteStreamClientChannelTest);

View file

@ -46,6 +46,15 @@ main() {
});
}
/// Wrapper around the test package's `fail` function.
///
/// Unlike the test package's `fail` function, this function is not annotated
/// with @alwaysThrows, so we can call it at the top of a test method without
/// causing the rest of the method to be flagged as dead code.
void _fail(String message) {
fail(message);
}
@reflectiveTest
class AbstractContextManagerTest extends ContextManagerTest {
void test_contextsInAnalysisRoot_nestedContext() {
@ -86,7 +95,7 @@ class AbstractContextManagerTest extends ContextManagerTest {
// package:analysis_server/src/context_manager.dart 1043:16 ContextManagerImpl._checkForPackagespecUpdate
// package:analysis_server/src/context_manager.dart 1553:5 ContextManagerImpl._handleWatchEvent
//return super.test_embedder_added();
fail('NoSuchMethodError');
_fail('NoSuchMethodError');
// Create files.
String libPath = '$projPath/${ContextManagerTest.LIB_NAME}';
newFile('$libPath/main.dart');
@ -2164,7 +2173,7 @@ analyzer:
//return super.test_optionsFile_update_strongMode();
// After a few other changes, the test now times out on my machine, so I'm
// disabling it in order to prevent it from being flaky.
fail('Test times out');
_fail('Test times out');
var file = resourceProvider.newFile('$projPath/bin/test.dart', r'''
main() {
var paths = <int>[];

View file

@ -19,7 +19,6 @@ import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'domain_completion_util.dart';
import 'mocks.dart' show pumpEventQueue;
main() {
defineReflectiveSuite(() {

View file

@ -31,6 +31,15 @@ main() {
});
}
/// Wrapper around the test package's `fail` function.
///
/// Unlike the test package's `fail` function, this function is not annotated
/// with @alwaysThrows, so we can call it at the top of a test method without
/// causing the rest of the method to be flagged as dead code.
void _fail(String message) {
fail(message);
}
@reflectiveTest
class ConvertGetterMethodToMethodTest extends _AbstractGetRefactoring_Test {
test_function() {
@ -1214,7 +1223,7 @@ class MoveFileTest extends _AbstractGetRefactoring_Test {
@failingTest
test_OK() {
fail('The move file refactoring is not supported under the new driver');
_fail('The move file refactoring is not supported under the new driver');
newFile('/project/bin/lib.dart');
addTestFile('''
import 'dart:math';

View file

@ -16,6 +16,15 @@ main() {
});
}
/// Wrapper around the test package's `fail` function.
///
/// Unlike the test package's `fail` function, this function is not annotated
/// with @alwaysThrows, so we can call it at the top of a test method without
/// causing the rest of the method to be flagged as dead code.
void _fail(String message) {
fail(message);
}
@reflectiveTest
class OptionsIntegrationTest extends AbstractAnalysisServerIntegrationTest {
@failingTest
@ -23,7 +32,7 @@ class OptionsIntegrationTest extends AbstractAnalysisServerIntegrationTest {
// TimeoutException after 0:00:30.000000: Test timed out after 30 seconds
// (#28868).
fail('test timeout expected - #28868');
_fail('test timeout expected - #28868');
String options = sourcePath(AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE);
writeFile(options, '''
@ -54,7 +63,7 @@ linter:
// TimeoutException after 0:00:30.000000: Test timed out after 30 seconds
// (#28868).
fail('test timeout expected - #28868');
_fail('test timeout expected - #28868');
String options = sourcePath(AnalysisEngine.ANALYSIS_OPTIONS_FILE);
writeFile(options, '''

View file

@ -84,7 +84,6 @@ part of foo;
}
}
fail('No element found for index $index');
return null;
}
void checkLocal(

View file

@ -50,7 +50,6 @@ main() {
}
}
fail('No element found matching $elementName');
return null;
}
void check(String elementName, Iterable<String> expectedOccurrences) {

View file

@ -270,7 +270,6 @@ class HierarchyResults {
return items[nameToIndex[name]];
} else {
fail('Class $name not found in hierarchy results');
return null;
}
}
}

View file

@ -17,6 +17,15 @@ main() {
});
}
/// Wrapper around the test package's `fail` function.
///
/// Unlike the test package's `fail` function, this function is not annotated
/// with @alwaysThrows, so we can call it at the top of a test method without
/// causing the rest of the method to be flagged as dead code.
void _fail(String message) {
fail(message);
}
@reflectiveTest
class SetSubscriptionsTest extends AbstractAnalysisServerIntegrationTest {
@failingTest
@ -24,7 +33,7 @@ class SetSubscriptionsTest extends AbstractAnalysisServerIntegrationTest {
// This test times out on the bots and has been disabled to keep them green.
// We need to discover the cause and re-enable it.
fail(
_fail(
'This test times out on the bots and has been disabled to keep them green.'
'We need to discover the cause and re-enable it.');

View file

@ -46,20 +46,6 @@ Matcher isResponseFailure(String id, [RequestErrorCode code]) =>
*/
Matcher isResponseSuccess(String id) => new _IsResponseSuccess(id);
/**
* Returns a [Future] that completes after pumping the event queue [times]
* times. By default, this should pump the event queue enough times to allow
* any code to run, as long as it's not waiting on some external event.
*/
Future pumpEventQueue([int times = 5000]) {
if (times == 0) return new Future.value();
// We use a delayed future to allow microtask events to finish. The
// Future.value or Future() constructors use scheduleMicrotask themselves and
// would therefore not wait for microtask callbacks that are scheduled after
// invoking this method.
return new Future.delayed(Duration.ZERO, () => pumpEventQueue(times - 1));
}
/**
* A mock [PackageMapProvider].
*/

View file

@ -76,7 +76,6 @@ part '$testFile';
}
}
fail('Failed to find $expectedUri in $uriList');
return null;
}
void assertImportedLib(String expectedUri) {

View file

@ -100,6 +100,5 @@ class TestAbstractRequestHandler extends AbstractRequestHandler {
@override
Response handleRequest(Request request) {
fail('Unexpected invocation of handleRequest');
return null;
}
}

View file

@ -22,6 +22,15 @@ main() {
});
}
/// Wrapper around the test package's `fail` function.
///
/// Unlike the test package's `fail` function, this function is not annotated
/// with @alwaysThrows, so we can call it at the top of a test method without
/// causing the rest of the method to be flagged as dead code.
void _fail(String message) {
fail(message);
}
@reflectiveTest
class NotificationManagerTest extends ProtocolTestUtilities {
String testDir;
@ -355,7 +364,7 @@ class NotificationManagerTest extends ProtocolTestUtilities {
@failingTest
void test_recordOutlines_withSubscription() {
fail('The outline handling needs to be re-worked slightly');
_fail('The outline handling needs to be re-worked slightly');
// TODO(brianwilkerson) Figure out outlines. What should we do when merge
// cannot produce a single outline?
manager.setSubscriptions({

View file

@ -145,7 +145,6 @@ var b = new Text('bbb');
}
}
fail('Not found $name in $unit');
return null;
}
InstanceCreationExpression _getTopVariableCreation(String name,

View file

@ -11,8 +11,6 @@ import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'package:watcher/watcher.dart';
import '../mocks.dart';
main() {
defineReflectiveSuite(() {
defineReflectiveTests(WatchManagerTest);

View file

@ -9,7 +9,6 @@ import 'dart:async';
import 'package:analyzer/src/cancelable_future.dart';
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'package:watcher/src/utils.dart';
void main() {
defineReflectiveSuite(() {

View file

@ -353,7 +353,6 @@ const b = null;
node = node.parent;
}
fail('Node not found');
return null;
}
}

View file

@ -36,6 +36,15 @@ main() {
});
}
/// Wrapper around the test package's `fail` function.
///
/// Unlike the test package's `fail` function, this function is not annotated
/// with @alwaysThrows, so we can call it at the top of a test method without
/// causing the rest of the method to be flagged as dead code.
void _fail(String message) {
fail(message);
}
@reflectiveTest
class ElementResolverCodeTest extends ResolverTestCase {
test_annotation_class_namedConstructor() async {
@ -317,7 +326,7 @@ class ElementResolverTest extends EngineTestCase {
ElementResolver _resolver;
void fail_visitExportDirective_combinators() {
fail("Not yet tested");
_fail("Not yet tested");
// Need to set up the exported library so that the identifier can be
// resolved.
ExportDirective directive = AstTestFactory.exportDirective2(null, [
@ -328,12 +337,12 @@ class ElementResolverTest extends EngineTestCase {
}
void fail_visitFunctionExpressionInvocation() {
fail("Not yet tested");
_fail("Not yet tested");
_listener.assertNoErrors();
}
void fail_visitImportDirective_combinators_noPrefix() {
fail("Not yet tested");
_fail("Not yet tested");
// Need to set up the imported library so that the identifier can be
// resolved.
ImportDirective directive = AstTestFactory.importDirective3(null, null, [
@ -344,7 +353,7 @@ class ElementResolverTest extends EngineTestCase {
}
void fail_visitImportDirective_combinators_prefix() {
fail("Not yet tested");
_fail("Not yet tested");
// Need to set up the imported library so that the identifiers can be
// resolved.
String prefixName = "p";
@ -361,7 +370,7 @@ class ElementResolverTest extends EngineTestCase {
}
void fail_visitRedirectingConstructorInvocation() {
fail("Not yet tested");
_fail("Not yet tested");
_listener.assertNoErrors();
}

View file

@ -250,13 +250,11 @@ class TestAnalysisContext implements InternalAnalysisContext {
@override
AnalysisCache get analysisCache {
fail("Unexpected invocation of analysisCache");
return null;
}
@override
AnalysisOptions get analysisOptions {
fail("Unexpected invocation of getAnalysisOptions");
return null;
}
@override
@ -272,7 +270,6 @@ class TestAnalysisContext implements InternalAnalysisContext {
@override
CacheConsistencyValidator get cacheConsistencyValidator {
fail("Unexpected invocation of cacheConsistencyValidator");
return null;
}
@override
@ -283,26 +280,22 @@ class TestAnalysisContext implements InternalAnalysisContext {
@override
DeclaredVariables get declaredVariables {
fail("Unexpected invocation of getDeclaredVariables");
return null;
}
@deprecated
@override
EmbedderYamlLocator get embedderYamlLocator {
fail("Unexpected invocation of get embedderYamlLocator");
return null;
}
@override
List<AnalysisTarget> get explicitTargets {
fail("Unexpected invocation of visitCacheItems");
return null;
}
@override
ResolverProvider get fileResolverProvider {
fail("Unexpected invocation of fileResolverProvider");
return null;
}
@override
@ -313,18 +306,15 @@ class TestAnalysisContext implements InternalAnalysisContext {
@override
List<Source> get htmlSources {
fail("Unexpected invocation of getHtmlSources");
return null;
}
@override
Stream<ImplicitAnalysisEvent> get implicitAnalysisEvents {
fail("Unexpected invocation of analyzedSources");
return null;
}
bool get isActive {
fail("Unexpected invocation of isActive");
return false;
}
void set isActive(bool isActive) {
@ -334,31 +324,26 @@ class TestAnalysisContext implements InternalAnalysisContext {
@override
bool get isDisposed {
fail("Unexpected invocation of isDisposed");
return false;
}
@override
List<Source> get launchableClientLibrarySources {
fail("Unexpected invocation of getLaunchableClientLibrarySources");
return null;
}
@override
List<Source> get launchableServerLibrarySources {
fail("Unexpected invocation of getLaunchableServerLibrarySources");
return null;
}
@override
List<Source> get librarySources {
fail("Unexpected invocation of getLibrarySources");
return null;
}
@override
String get name {
fail("Unexpected invocation of name");
return null;
}
@override
@ -369,31 +354,26 @@ class TestAnalysisContext implements InternalAnalysisContext {
@override
Stream<SourcesChangedEvent> get onSourcesChanged {
fail("Unexpected invocation of onSourcesChanged");
return null;
}
@override
List<Source> get prioritySources {
fail("Unexpected invocation of getPrioritySources");
return null;
}
@override
List<AnalysisTarget> get priorityTargets {
fail("Unexpected invocation of visitCacheItems");
return null;
}
@override
CachePartition get privateAnalysisCachePartition {
fail("Unexpected invocation of privateAnalysisCachePartition");
return null;
}
@override
SourceFactory get sourceFactory {
fail("Unexpected invocation of getSourceFactory");
return null;
}
@override
@ -404,13 +384,11 @@ class TestAnalysisContext implements InternalAnalysisContext {
@override
List<Source> get sources {
fail("Unexpected invocation of sources");
return null;
}
@override
TypeProvider get typeProvider {
fail("Unexpected invocation of getTypeProvider");
return null;
}
@override
@ -421,19 +399,16 @@ class TestAnalysisContext implements InternalAnalysisContext {
@override
TypeSystem get typeSystem {
fail("Unexpected invocation of getTypeSystem");
return null;
}
@override
List<WorkManager> get workManagers {
fail("Unexpected invocation of workManagers");
return null;
}
@override
bool aboutToComputeResult(CacheEntry entry, ResultDescriptor result) {
fail("Unexpected invocation of aboutToComputeResult");
return false;
}
@override
@ -449,62 +424,52 @@ class TestAnalysisContext implements InternalAnalysisContext {
@override
void applyChanges(ChangeSet changeSet) {
fail("Unexpected invocation of applyChanges");
return null;
}
@override
String computeDocumentationComment(Element element) {
fail("Unexpected invocation of computeDocumentationComment");
return null;
}
@override
List<AnalysisError> computeErrors(Source source) {
fail("Unexpected invocation of computeErrors");
return null;
}
@override
List<Source> computeExportedLibraries(Source source) {
fail("Unexpected invocation of computeExportedLibraries");
return null;
}
@override
List<Source> computeImportedLibraries(Source source) {
fail("Unexpected invocation of computeImportedLibraries");
return null;
}
@override
SourceKind computeKindOf(Source source) {
fail("Unexpected invocation of computeKindOf");
return null;
}
@override
LibraryElement computeLibraryElement(Source source) {
fail("Unexpected invocation of computeLibraryElement");
return null;
}
@override
LineInfo computeLineInfo(Source source) {
fail("Unexpected invocation of computeLineInfo");
return null;
}
@override
CancelableFuture<CompilationUnit> computeResolvedCompilationUnitAsync(
Source source, Source librarySource) {
fail("Unexpected invocation of getResolvedCompilationUnitFuture");
return null;
}
@override
V computeResult<V>(AnalysisTarget target, ResultDescriptor<V> result) {
fail("Unexpected invocation of computeResult");
return null;
}
@override
@ -515,150 +480,126 @@ class TestAnalysisContext implements InternalAnalysisContext {
@override
List<CompilationUnit> ensureResolvedDartUnits(Source source) {
fail("Unexpected invocation of ensureResolvedDartUnits");
return null;
}
@override
bool exists(Source source) {
fail("Unexpected invocation of exists");
return false;
}
@override
CacheEntry getCacheEntry(AnalysisTarget target) {
fail("Unexpected invocation of visitCacheItems");
return null;
}
@override
CompilationUnitElement getCompilationUnitElement(
Source unitSource, Source librarySource) {
fail("Unexpected invocation of getCompilationUnitElement");
return null;
}
@deprecated
@override
V getConfigurationData<V>(ResultDescriptor<V> key) {
fail("Unexpected invocation of getConfigurationData");
return null;
}
@override
TimestampedData<String> getContents(Source source) {
fail("Unexpected invocation of getContents");
return null;
}
@override
InternalAnalysisContext getContextFor(Source source) {
fail("Unexpected invocation of getContextFor");
return null;
}
@override
Element getElement(ElementLocation location) {
fail("Unexpected invocation of getElement");
return null;
}
@override
AnalysisErrorInfo getErrors(Source source) {
fail("Unexpected invocation of getErrors");
return null;
}
@override
List<Source> getHtmlFilesReferencing(Source source) {
fail("Unexpected invocation of getHtmlFilesReferencing");
return null;
}
@override
SourceKind getKindOf(Source source) {
fail("Unexpected invocation of getKindOf");
return null;
}
@override
List<Source> getLibrariesContaining(Source source) {
fail("Unexpected invocation of getLibrariesContaining");
return null;
}
@override
List<Source> getLibrariesDependingOn(Source librarySource) {
fail("Unexpected invocation of getLibrariesDependingOn");
return null;
}
@override
List<Source> getLibrariesReferencedFromHtml(Source htmlSource) {
fail("Unexpected invocation of getLibrariesReferencedFromHtml");
return null;
}
@override
LibraryElement getLibraryElement(Source source) {
fail("Unexpected invocation of getLibraryElement");
return null;
}
@override
LineInfo getLineInfo(Source source) {
fail("Unexpected invocation of getLineInfo");
return null;
}
@override
int getModificationStamp(Source source) {
fail("Unexpected invocation of getModificationStamp");
return 0;
}
@override
ChangeNoticeImpl getNotice(Source source) {
fail("Unexpected invocation of getNotice");
return null;
}
@override
Namespace getPublicNamespace(LibraryElement library) {
fail("Unexpected invocation of getPublicNamespace");
return null;
}
@override
CompilationUnit getResolvedCompilationUnit(
Source unitSource, LibraryElement library) {
fail("Unexpected invocation of getResolvedCompilationUnit");
return null;
}
@override
CompilationUnit getResolvedCompilationUnit2(
Source unitSource, Source librarySource) {
fail("Unexpected invocation of getResolvedCompilationUnit");
return null;
}
@override
V getResult<V>(AnalysisTarget target, ResultDescriptor<V> result) {
fail("Unexpected invocation of getResult");
return null;
}
@override
List<Source> getSourcesWithFullName(String path) {
fail("Unexpected invocation of getSourcesWithFullName");
return null;
}
@override
bool handleContentsChanged(
Source source, String originalContents, String newContents, bool notify) {
fail("Unexpected invocation of handleContentsChanged");
return false;
}
@override
@ -669,44 +610,37 @@ class TestAnalysisContext implements InternalAnalysisContext {
@override
bool isClientLibrary(Source librarySource) {
fail("Unexpected invocation of isClientLibrary");
return false;
}
@override
bool isServerLibrary(Source librarySource) {
fail("Unexpected invocation of isServerLibrary");
return false;
}
@override
Stream<ResultChangedEvent> onResultChanged(ResultDescriptor descriptor) {
fail("Unexpected invocation of onResultChanged");
return null;
}
@deprecated
@override
Stream<ComputedResult> onResultComputed(ResultDescriptor descriptor) {
fail("Unexpected invocation of onResultComputed");
return null;
}
@override
CompilationUnit parseCompilationUnit(Source source) {
fail("Unexpected invocation of parseCompilationUnit");
return null;
}
@override
Document parseHtmlDocument(Source source) {
fail("Unexpected invocation of parseHtmlDocument");
return null;
}
@override
AnalysisResult performAnalysisTask() {
fail("Unexpected invocation of performAnalysisTask");
return null;
}
@override
@ -723,14 +657,12 @@ class TestAnalysisContext implements InternalAnalysisContext {
CompilationUnit resolveCompilationUnit(
Source unitSource, LibraryElement library) {
fail("Unexpected invocation of resolveCompilationUnit");
return null;
}
@override
CompilationUnit resolveCompilationUnit2(
Source unitSource, Source librarySource) {
fail("Unexpected invocation of resolveCompilationUnit");
return null;
}
@override
@ -753,7 +685,6 @@ class TestAnalysisContext implements InternalAnalysisContext {
@override
bool shouldErrorsBeAnalyzed(Source source) {
fail("Unexpected invocation of shouldErrorsBeAnalyzed");
return false;
}
@override

View file

@ -254,6 +254,5 @@ class _MockPackages implements Packages {
@override
Uri resolve(Uri packageUri, {Uri notFound(Uri packageUri)}) {
fail('Unexpected invocation of resolve');
return null;
}
}

View file

@ -57,6 +57,15 @@ main() {
});
}
/// Wrapper around the test package's `fail` function.
///
/// Unlike the test package's `fail` function, this function is not annotated
/// with @alwaysThrows, so we can call it at the top of a test method without
/// causing the rest of the method to be flagged as dead code.
void _fail(String message) {
fail(message);
}
@reflectiveTest
class AnalysisDeltaTest extends EngineTestCase {
TestSource source1 = new TestSource('/1.dart');
@ -2534,17 +2543,17 @@ class TypeResolverVisitorTest extends ParserTestCase {
TypeResolverVisitor _visitor;
fail_visitConstructorDeclaration() async {
fail("Not yet tested");
_fail("Not yet tested");
_listener.assertNoErrors();
}
fail_visitFunctionTypeAlias() async {
fail("Not yet tested");
_fail("Not yet tested");
_listener.assertNoErrors();
}
fail_visitVariableDeclaration() async {
fail("Not yet tested");
_fail("Not yet tested");
ClassElement type = ElementFactory.classElement2("A");
VariableDeclaration node = AstTestFactory.variableDeclaration("a");
AstTestFactory

View file

@ -60,7 +60,6 @@ class DartSdkManagerTest extends EngineTestCase {
DartSdk _failIfAbsent() {
fail('Use of ifAbsent function');
return null;
}
}

View file

@ -36,6 +36,15 @@ main() {
});
}
/// Wrapper around the test package's `fail` function.
///
/// Unlike the test package's `fail` function, this function is not annotated
/// with @alwaysThrows, so we can call it at the top of a test method without
/// causing the rest of the method to be flagged as dead code.
void _fail(String message) {
fail(message);
}
/**
* Like [StaticTypeAnalyzerTest], but as end-to-end tests.
*/
@ -199,17 +208,17 @@ class StaticTypeAnalyzerTest extends EngineTestCase {
TypeSystem get _typeSystem => _visitor.typeSystem;
void fail_visitFunctionExpressionInvocation() {
fail("Not yet tested");
_fail("Not yet tested");
_listener.assertNoErrors();
}
void fail_visitMethodInvocation() {
fail("Not yet tested");
_fail("Not yet tested");
_listener.assertNoErrors();
}
void fail_visitSimpleIdentifier() {
fail("Not yet tested");
_fail("Not yet tested");
_listener.assertNoErrors();
}

View file

@ -73,7 +73,6 @@ class EngineTestCase {
}
}
fail("Could not find getter named $getterName in ${type.displayName}");
return null;
}
/**
@ -90,7 +89,6 @@ class EngineTestCase {
}
}
fail("Could not find method named $methodName in ${type.displayName}");
return null;
}
void setUp() {

View file

@ -50,7 +50,6 @@ class AstCloneComparator extends AstComparator {
bool isEqualNodes(AstNode first, AstNode second) {
if (first != null && identical(first, second)) {
fail('Failed to copy node: $first (${first.offset})');
return false;
}
return super.isEqualNodes(first, second);
}
@ -59,7 +58,6 @@ class AstCloneComparator extends AstComparator {
bool isEqualTokens(Token first, Token second) {
if (expectTokensCopied && first != null && identical(first, second)) {
fail('Failed to copy token: ${first.lexeme} (${first.offset})');
return false;
}
if (first?.precedingComments != null) {
CommentToken comment = first.precedingComments;

View file

@ -32,7 +32,6 @@ import 'package:analyzer/task/model.dart';
import 'package:html/dom.dart' show Document;
import 'package:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';
import 'package:watcher/src/utils.dart';
import '../../generated/engine_test.dart';
import '../../generated/test_support.dart';

View file

@ -58,6 +58,5 @@ class _MockPackages implements Packages {
@override
Uri resolve(Uri packageUri, {Uri notFound(Uri packageUri)}) {
fail('Unexpected invocation of resolve');
return null;
}
}

View file

@ -18,6 +18,15 @@ main() {
/// them, or know that this is an analyzer problem.
const potentialAnalyzerProblem = const Object();
/// Wrapper around the test package's `fail` function.
///
/// Unlike the test package's `fail` function, this function is not annotated
/// with @alwaysThrows, so we can call it at the top of a test method without
/// causing the rest of the method to be flagged as dead code.
void _fail(String message) {
fail(message);
}
@reflectiveTest
class AnalysisDriverResolutionTest_Kernel extends AnalysisDriverResolutionTest {
@override
@ -201,7 +210,7 @@ class AnalysisDriverTest_Kernel extends AnalysisDriverTest {
@FastaProblem('https://github.com/dart-lang/sdk/issues/30959')
@override
test_part_getUnitElement_noLibrary() async {
fail('This test fails even with @failingTest');
_fail('This test fails even with @failingTest');
await super.test_part_getUnitElement_noLibrary();
}

View file

@ -5564,7 +5564,6 @@ typedef void F(int p);
}
}
fail('Not found main() in ${result.unit}');
return null;
}
/**
@ -8396,7 +8395,6 @@ class F extends X {}
}
}
fail('Cannot find the class $name in\n$unit');
return null;
}
VariableDeclaration _getClassField(
@ -8412,7 +8410,6 @@ class F extends X {}
}
}
fail('Cannot find the field $fieldName in the class $className in\n$unit');
return null;
}
String _getClassFieldType(
@ -8435,7 +8432,6 @@ class F extends X {}
}
fail('Cannot find the method $methodName in the class $className in\n'
'$unit');
return null;
}
String _getClassMethodReturnType(
@ -8468,7 +8464,6 @@ class F extends X {}
}
}
fail('Cannot find the top-level variable $name in\n$unit');
return null;
}
String _getTopLevelVarType(CompilationUnit unit, String name) {

View file

@ -197,7 +197,6 @@ class MockAnalysisDriver implements AnalysisDriver {
@override
dynamic noSuchMethod(Invocation invocation) {
fail('Unexpected invocation of ${invocation.memberName}');
return null;
}
@override

View file

@ -1456,7 +1456,6 @@ class A {
}
}
fail('Class member not found');
return null;
}
EvaluationResultImpl _evaluateTopLevelVariable(

View file

@ -1925,7 +1925,6 @@ class DartObjectImplTest extends EngineTestCase {
return new DartObjectImpl(_typeProvider.boolType, BoolState.TRUE_STATE);
}
fail("Invalid boolean value used in test");
return null;
}
DartObjectImpl _doubleValue(double value) {

View file

@ -51,7 +51,6 @@ class ResultComparator extends AstComparator {
_safelyWriteNodePath(buffer, first.owner);
}
fail(buffer.toString());
return false;
}
@override
@ -78,7 +77,6 @@ class ResultComparator extends AstComparator {
_safelyWriteNodePath(buffer, first);
}
fail(buffer.toString());
return false;
}
@override
@ -92,7 +90,6 @@ class ResultComparator extends AstComparator {
_safelyWriteNodePath(buffer, first);
}
fail(buffer.toString());
return false;
}
/**

View file

@ -1200,7 +1200,6 @@ abstract class AbstractResynthesizeTest extends AbstractSingleUnitTest {
} else {
fail('Unexpected type for resynthesized ($desc):'
' ${element.runtimeType}');
return null;
}
}

View file

@ -325,7 +325,6 @@ abstract class SummaryTest {
found.add(dep.uri);
}
fail('Did not find dependency $relativeUri. Found: $found');
return null;
}
/**

View file

@ -1114,7 +1114,6 @@ class ComputeConstantDependenciesTaskTest extends _AbstractDartTaskTest {
}
}
fail('Annotation not found');
return null;
}
test_annotation_with_args() {
@ -1269,7 +1268,6 @@ class ComputeConstantValueTaskTest extends _AbstractDartTaskTest {
}
}
fail('Annotation not found');
return null;
}
test_annotation_non_const_constructor() {

View file

@ -74,7 +74,6 @@ class AstFinder {
}
Source source = resolutionMap.elementDeclaredByCompilationUnit(unit).source;
fail('No class named $className in $source');
return null;
}
/**
@ -94,7 +93,6 @@ class AstFinder {
}
}
fail('No constructor named $constructorName in $className');
return null;
}
/**
@ -116,7 +114,6 @@ class AstFinder {
}
}
fail('No field named $fieldName in $className');
return null;
}
/**
@ -144,7 +141,6 @@ class AstFinder {
}
}
fail('No method named $methodName in $className');
return null;
}
/**
@ -185,7 +181,6 @@ class AstFinder {
}
}
fail('No toplevel function named $functionName found');
return null;
}
/**
@ -207,7 +202,6 @@ class AstFinder {
}
}
fail('No toplevel variable named $variableName found');
return null;
}
/**