6cd11ed89c
The existing hand-written stub constructors don't follow a specific pattern; some have a functional body, some have a block body, etc. This CL unifies all of the non-redirecting, non-const constructor bodies to throw 0. Some constructors are corrected to be their true redirecting form. Change-Id: I0a3e0bf777663424ff8dcaeddcaed9fa85b29b96 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/461540 Reviewed-by: Konstantin Shcheglov <scheglov@google.com> Commit-Queue: Samuel Rawlins <srawlins@google.com>
59 lines
1.8 KiB
Dart
59 lines
1.8 KiB
Dart
// Copyright (c) 2015, 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:analysis_server/protocol/protocol_generated.dart';
|
|
import 'package:test/test.dart';
|
|
import 'package:test_reflective_loader/test_reflective_loader.dart';
|
|
|
|
import 'analysis_server_base.dart';
|
|
|
|
void main() {
|
|
defineReflectiveSuite(() {
|
|
defineReflectiveTests(DiagnosticDomainTest);
|
|
});
|
|
}
|
|
|
|
@reflectiveTest
|
|
class DiagnosticDomainTest extends PubPackageAnalysisServerTest {
|
|
Future<void> test_getDiagnostics() async {
|
|
newPubspecYamlFile(testPackageRootPath, 'name: project');
|
|
newFile('$testPackageLibPath/test.dart', 'void f() {}');
|
|
|
|
await setRoots(included: [workspaceRootPath], excluded: []);
|
|
await server.onAnalysisComplete;
|
|
|
|
var request = DiagnosticGetDiagnosticsParams().toRequest(
|
|
'0',
|
|
clientUriConverter: server.uriConverter,
|
|
);
|
|
var response = await handleSuccessfulRequest(request);
|
|
var result = DiagnosticGetDiagnosticsResult.fromResponse(
|
|
response,
|
|
clientUriConverter: server.uriConverter,
|
|
);
|
|
|
|
var context = result.contexts.singleWhere(
|
|
(context) => context.name == testPackageRoot.path,
|
|
);
|
|
expect(context.explicitFileCount, 1); /* test.dart */
|
|
|
|
expect(context.implicitFileCount, 6);
|
|
|
|
expect(context.workItemQueueLength, isNotNull);
|
|
}
|
|
|
|
Future<void> test_getDiagnostics_noRoot() async {
|
|
var request = DiagnosticGetDiagnosticsParams().toRequest(
|
|
'0',
|
|
clientUriConverter: server.uriConverter,
|
|
);
|
|
var response = await handleSuccessfulRequest(request);
|
|
var result = DiagnosticGetDiagnosticsResult.fromResponse(
|
|
response,
|
|
clientUriConverter: server.uriConverter,
|
|
);
|
|
expect(result.contexts, isEmpty);
|
|
}
|
|
}
|