Skip to content

Commit aec4729

Browse files
committed
Move older experiments out now that the beta branch exists
1 parent 622db50 commit aec4729

File tree

8 files changed

+124
-134
lines changed

8 files changed

+124
-134
lines changed

test/end2end/dartdoc_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import 'package:test/test.dart';
2020
import '../src/utils.dart';
2121

2222
final _experimentPackageAllowed =
23-
VersionRange(min: Version.parse('2.14.0-0'), includeMin: true);
23+
VersionRange(min: Version.parse('2.15.0-0'), includeMin: true);
2424

2525
final _resourceProvider = pubPackageMetaProvider.resourceProvider;
2626
final _pathContext = _resourceProvider.pathContext;

test/end2end/model_special_cases_test.dart

Lines changed: 0 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ library dartdoc.model_special_cases_test;
1010

1111
import 'dart:io';
1212

13-
import 'package:analyzer/dart/element/type.dart';
1413
import 'package:async/async.dart';
1514
import 'package:dartdoc/src/matching_link_result.dart';
1615
import 'package:dartdoc/src/model/model.dart';
@@ -73,10 +72,6 @@ void main() {
7372
// ExperimentalFeature.experimentalReleaseVersion as these are set to null
7473
// even when partial analyzer implementations are available, and are often
7574
// set too high after release.
76-
final _genericMetadataAllowed =
77-
VersionRange(min: Version.parse('2.14.0-0'), includeMin: true);
78-
final _tripleShiftAllowed =
79-
VersionRange(min: Version.parse('2.14.0-0'), includeMin: true);
8075
final _constructorTearoffsAllowed =
8176
VersionRange(min: Version.parse('2.15.0-0'), includeMin: true);
8277

@@ -177,125 +172,6 @@ void main() {
177172
equals(MatchingLinkResult(Fnew)));
178173
});
179174
}, skip: !_constructorTearoffsAllowed.allows(utils.platformVersion));
180-
181-
group('triple-shift', () {
182-
Library tripleShift;
183-
Class C, E, F;
184-
Extension ShiftIt;
185-
Operator classShift, extensionShift;
186-
Field constantTripleShifted;
187-
188-
setUpAll(() async {
189-
tripleShift = (await _testPackageGraphExperiments)
190-
.libraries
191-
.firstWhere((l) => l.name == 'triple_shift');
192-
C = tripleShift.classes.firstWhere((c) => c.name == 'C');
193-
E = tripleShift.classes.firstWhere((c) => c.name == 'E');
194-
F = tripleShift.classes.firstWhere((c) => c.name == 'F');
195-
ShiftIt = tripleShift.extensions.firstWhere((e) => e.name == 'ShiftIt');
196-
classShift =
197-
C.instanceOperators.firstWhere((o) => o.name.contains('>>>'));
198-
extensionShift =
199-
ShiftIt.instanceOperators.firstWhere((o) => o.name.contains('>>>'));
200-
constantTripleShifted = C.constantFields
201-
.firstWhere((f) => f.name == 'constantTripleShifted');
202-
});
203-
204-
test('constants with triple shift render correctly', () {
205-
expect(constantTripleShifted.constantValue, equals('3 >>> 5'));
206-
});
207-
208-
test('operators exist and are named correctly', () {
209-
expect(classShift.name, equals('operator >>>'));
210-
expect(extensionShift.name, equals('operator >>>'));
211-
});
212-
213-
test(
214-
'inheritance and overriding of triple shift operators works correctly',
215-
() {
216-
var tripleShiftE =
217-
E.instanceOperators.firstWhere((o) => o.name.contains('>>>'));
218-
var tripleShiftF =
219-
F.instanceOperators.firstWhere((o) => o.name.contains('>>>'));
220-
221-
expect(tripleShiftE.isInherited, isTrue);
222-
expect(tripleShiftE.canonicalModelElement, equals(classShift));
223-
expect(tripleShiftE.modelType.returnType.name, equals('C'));
224-
expect(tripleShiftF.isInherited, isFalse);
225-
expect(tripleShiftF.modelType.returnType.name, equals('F'));
226-
});
227-
}, skip: !_tripleShiftAllowed.allows(utils.platformVersion));
228-
229-
group('generic metadata', () {
230-
Library genericMetadata;
231-
TopLevelVariable f;
232-
Typedef F;
233-
Class C;
234-
Method mp, mn;
235-
236-
setUpAll(() async {
237-
genericMetadata = (await _testPackageGraphExperiments)
238-
.libraries
239-
.firstWhere((l) => l.name == 'generic_metadata');
240-
F = genericMetadata.typedefs.firstWhere((t) => t.name == 'F');
241-
f = genericMetadata.properties.firstWhere((p) => p.name == 'f');
242-
C = genericMetadata.classes.firstWhere((c) => c.name == 'C');
243-
mp = C.instanceMethods.firstWhere((m) => m.name == 'mp');
244-
mn = C.instanceMethods.firstWhere((m) => m.name == 'mn');
245-
});
246-
247-
test(
248-
'Verify annotations and their type arguments render on type parameters for typedefs',
249-
() {
250-
expect((F.aliasedType as FunctionType).typeFormals.first.metadata,
251-
isNotEmpty);
252-
expect((F.aliasedType as FunctionType).parameters.first.metadata,
253-
isNotEmpty);
254-
// TODO(jcollins-g): add rendering verification once we have data from
255-
// analyzer.
256-
}, skip: 'dart-lang/sdk#46064');
257-
258-
test('Verify type arguments on annotations renders, including parameters',
259-
() {
260-
var ab0 =
261-
'@<a href="%%__HTMLBASE_dartdoc_internal__%%generic_metadata/A-class.html">A</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="%%__HTMLBASE_dartdoc_internal__%%generic_metadata/B.html">B</a></span>&gt;</span>(0)';
262-
263-
expect(genericMetadata.annotations.first.linkedNameWithParameters,
264-
equals(ab0));
265-
expect(f.annotations.first.linkedNameWithParameters, equals(ab0));
266-
expect(C.annotations.first.linkedNameWithParameters, equals(ab0));
267-
expect(
268-
C.typeParameters.first.annotations.first.linkedNameWithParameters,
269-
equals(ab0));
270-
expect(
271-
mp.parameters
272-
.map((p) => p.annotations.first.linkedNameWithParameters),
273-
everyElement(equals(ab0)));
274-
expect(
275-
mn.parameters
276-
.map((p) => p.annotations.first.linkedNameWithParameters),
277-
everyElement(equals(ab0)));
278-
279-
expect(genericMetadata.features.map((f) => f.linkedNameWithParameters),
280-
contains(ab0));
281-
expect(
282-
f.features.map((f) => f.linkedNameWithParameters), contains(ab0));
283-
expect(
284-
C.features.map((f) => f.linkedNameWithParameters), contains(ab0));
285-
expect(
286-
C.typeParameters.first.features
287-
.map((f) => f.linkedNameWithParameters),
288-
contains(ab0));
289-
expect(
290-
mp.parameters
291-
.map((p) => p.features.map((f) => f.linkedNameWithParameters)),
292-
everyElement(contains(ab0)));
293-
expect(
294-
mn.parameters
295-
.map((p) => p.features.map((f) => f.linkedNameWithParameters)),
296-
everyElement(contains(ab0)));
297-
});
298-
}, skip: !_genericMetadataAllowed.allows(utils.platformVersion));
299175
});
300176

301177
group('HTML Injection when allowed', () {

test/end2end/model_test.dart

Lines changed: 121 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ library dartdoc.model_test;
66

77
import 'dart:io';
88

9+
import 'package:analyzer/dart/element/type.dart';
910
import 'package:analyzer/source/line_info.dart';
1011
import 'package:async/async.dart';
1112
import 'package:dartdoc/src/element_type.dart';
@@ -23,15 +24,13 @@ import 'package:dartdoc/src/special_elements.dart';
2324
import 'package:dartdoc/src/warnings.dart';
2425
import 'package:test/test.dart';
2526

26-
import '../src/utils.dart' as utils;
27-
import '../src/utils.dart';
27+
import '../src/utils.dart'
28+
show bootBasicPackage, bothLookup, kTestPackagePublicLibraries, newLookup;
2829

2930
final _testPackageGraphMemo = AsyncMemoizer<PackageGraph>();
3031
Future<PackageGraph> get testPackageGraph async =>
31-
_testPackageGraphMemo.runOnce(() => utils.bootBasicPackage(
32-
'testing/test_package',
33-
pubPackageMetaProvider,
34-
PhysicalPackageConfigProvider(),
32+
_testPackageGraphMemo.runOnce(() => bootBasicPackage('testing/test_package',
33+
pubPackageMetaProvider, PhysicalPackageConfigProvider(),
3534
excludeLibraries: ['css', 'code_in_comments'],
3635
additionalArguments: ['--no-link-to-remote']));
3736

@@ -94,6 +93,121 @@ void main() {
9493
packageGraph.libraries.firstWhere((lib) => lib.name == 'base_class');
9594
});
9695

96+
group('triple-shift', () {
97+
Library tripleShift;
98+
Class C, E, F;
99+
Extension ShiftIt;
100+
Operator classShift, extensionShift;
101+
Field constantTripleShifted;
102+
103+
setUpAll(() async {
104+
tripleShift = (await testPackageGraph)
105+
.libraries
106+
.firstWhere((l) => l.name == 'triple_shift');
107+
C = tripleShift.classes.firstWhere((c) => c.name == 'C');
108+
E = tripleShift.classes.firstWhere((c) => c.name == 'E');
109+
F = tripleShift.classes.firstWhere((c) => c.name == 'F');
110+
ShiftIt = tripleShift.extensions.firstWhere((e) => e.name == 'ShiftIt');
111+
classShift =
112+
C.instanceOperators.firstWhere((o) => o.name.contains('>>>'));
113+
extensionShift =
114+
ShiftIt.instanceOperators.firstWhere((o) => o.name.contains('>>>'));
115+
constantTripleShifted =
116+
C.constantFields.firstWhere((f) => f.name == 'constantTripleShifted');
117+
});
118+
119+
test('constants with triple shift render correctly', () {
120+
expect(constantTripleShifted.constantValue, equals('3 &gt;&gt;&gt; 5'));
121+
});
122+
123+
test('operators exist and are named correctly', () {
124+
expect(classShift.name, equals('operator >>>'));
125+
expect(extensionShift.name, equals('operator >>>'));
126+
});
127+
128+
test('inheritance and overriding of triple shift operators works correctly',
129+
() {
130+
var tripleShiftE =
131+
E.instanceOperators.firstWhere((o) => o.name.contains('>>>'));
132+
var tripleShiftF =
133+
F.instanceOperators.firstWhere((o) => o.name.contains('>>>'));
134+
135+
expect(tripleShiftE.isInherited, isTrue);
136+
expect(tripleShiftE.canonicalModelElement, equals(classShift));
137+
expect(tripleShiftE.modelType.returnType.name, equals('C'));
138+
expect(tripleShiftF.isInherited, isFalse);
139+
expect(tripleShiftF.modelType.returnType.name, equals('F'));
140+
});
141+
});
142+
143+
group('generic metadata', () {
144+
Library genericMetadata;
145+
TopLevelVariable f;
146+
Typedef F;
147+
Class C;
148+
Method mp, mn;
149+
150+
setUpAll(() async {
151+
genericMetadata = (await testPackageGraph)
152+
.libraries
153+
.firstWhere((l) => l.name == 'generic_metadata');
154+
F = genericMetadata.typedefs.firstWhere((t) => t.name == 'F');
155+
f = genericMetadata.properties.firstWhere((p) => p.name == 'f');
156+
C = genericMetadata.classes.firstWhere((c) => c.name == 'C');
157+
mp = C.instanceMethods.firstWhere((m) => m.name == 'mp');
158+
mn = C.instanceMethods.firstWhere((m) => m.name == 'mn');
159+
});
160+
161+
test(
162+
'Verify annotations and their type arguments render on type parameters for typedefs',
163+
() {
164+
expect((F.aliasedType as FunctionType).typeFormals.first.metadata,
165+
isNotEmpty);
166+
expect((F.aliasedType as FunctionType).parameters.first.metadata,
167+
isNotEmpty);
168+
// TODO(jcollins-g): add rendering verification once we have data from
169+
// analyzer.
170+
}, skip: 'dart-lang/sdk#46064');
171+
172+
test('Verify type arguments on annotations renders, including parameters',
173+
() {
174+
var ab0 =
175+
'@<a href="%%__HTMLBASE_dartdoc_internal__%%generic_metadata/A-class.html">A</a><span class="signature">&lt;<wbr><span class="type-parameter"><a href="%%__HTMLBASE_dartdoc_internal__%%generic_metadata/B.html">B</a></span>&gt;</span>(0)';
176+
177+
expect(genericMetadata.annotations.first.linkedNameWithParameters,
178+
equals(ab0));
179+
expect(f.annotations.first.linkedNameWithParameters, equals(ab0));
180+
expect(C.annotations.first.linkedNameWithParameters, equals(ab0));
181+
expect(C.typeParameters.first.annotations.first.linkedNameWithParameters,
182+
equals(ab0));
183+
expect(
184+
mp.parameters
185+
.map((p) => p.annotations.first.linkedNameWithParameters),
186+
everyElement(equals(ab0)));
187+
expect(
188+
mn.parameters
189+
.map((p) => p.annotations.first.linkedNameWithParameters),
190+
everyElement(equals(ab0)));
191+
192+
expect(genericMetadata.features.map((f) => f.linkedNameWithParameters),
193+
contains(ab0));
194+
expect(f.features.map((f) => f.linkedNameWithParameters), contains(ab0));
195+
expect(C.features.map((f) => f.linkedNameWithParameters), contains(ab0));
196+
expect(
197+
C.typeParameters.first.features
198+
.map((f) => f.linkedNameWithParameters),
199+
contains(ab0));
200+
expect(
201+
mp.parameters
202+
.map((p) => p.features.map((f) => f.linkedNameWithParameters)),
203+
everyElement(contains(ab0)));
204+
expect(
205+
mn.parameters
206+
.map((p) => p.features.map((f) => f.linkedNameWithParameters)),
207+
everyElement(contains(ab0)));
208+
});
209+
});
210+
97211
group('generalized typedefs', () {
98212
Library generalizedTypedefs;
99213
Typedef T0, T1, T2, T3, T4, T5, T6, T7;
@@ -671,7 +785,7 @@ void main() {
671785
packageGraph
672786
.localPackages.first.defaultCategory.publicLibraries.length,
673787
// Only 5 libraries have categories, the rest belong in default.
674-
equals(utils.kTestPackagePublicLibraries - 5));
788+
equals(kTestPackagePublicLibraries - 5));
675789
});
676790

677791
// TODO consider moving these to a separate suite

test/src/utils.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import 'package:test/expect.dart';
2424
/// The number of public libraries in testing/test_package, minus 2 for
2525
/// the excluded libraries listed in the initializers for _testPackageGraphMemo
2626
/// and minus 1 for the <nodoc> tag in the 'excluded' library.
27-
const int kTestPackagePublicLibraries = 24;
27+
const int kTestPackagePublicLibraries = 27;
2828

2929
final _resourceProvider = pubPackageMetaProvider.resourceProvider;
3030
final _pathContext = _resourceProvider.pathContext;

testing/test_package/pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,4 @@ dependencies:
88
test_package_imported:
99
path: "../test_package_imported"
1010
environment:
11-
sdk: '>=2.13.0 <3.0.0'
11+
sdk: '>=2.14.0-0 <3.0.0'

0 commit comments

Comments
 (0)