Skip to content

Commit

Permalink
Merge branch 'master' into stable-renderers
Browse files Browse the repository at this point in the history
  • Loading branch information
srawlins committed Apr 20, 2021
2 parents 29a9224 + 856c613 commit 3ce8e21
Show file tree
Hide file tree
Showing 10 changed files with 82 additions and 76 deletions.
24 changes: 11 additions & 13 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,19 @@ jobs:
run: ./tool/travis.sh
env:
DARTDOC_BOT: ${{ matrix.job }}
# TODO(jcollins-g): uncomment after #2590 is fixed
#COVERAGE_TOKEN: true # this needs to be set to enable coverage
COVERAGE_TOKEN: true # this needs to be set to enable coverage
- name: ${{ matrix.job }}
if: runner.os == 'Windows' && matrix.job == 'main'
run: pub run grinder buildbot
env:
DARTDOC_BOT: ${{ matrix.job }}
# TODO(jcollins-g): uncomment after #2590 is fixed
#- id: coverage
# name: Upload coverage
# if: runner.os == 'Linux' && matrix.job == 'main' && matrix.sdk == 'dev'
# uses: coverallsapp/github-action@v1.1.2
# with:
# github-token: ${{ secrets.GITHUB_TOKEN }}
# path-to-lcov: lcov.info
#- name: Echo coveralls api result
# if: runner.os == 'Linux' && matrix.job == 'main' && matrix.sdk == 'dev'
# run: echo ${{ steps.coverage.outputs['coveralls-api-result'] }}
- id: coverage
name: Upload coverage
if: runner.os == 'Linux' && matrix.job == 'main' && matrix.sdk == 'dev'
uses: coverallsapp/github-action@v1.1.2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
path-to-lcov: lcov.info
- name: Echo coveralls api result
if: runner.os == 'Linux' && matrix.job == 'main' && matrix.sdk == 'dev'
run: echo ${{ steps.coverage.outputs['coveralls-api-result'] }}
7 changes: 0 additions & 7 deletions lib/src/generator/templates.renderers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -688,13 +688,6 @@ class _Renderer_Categorization extends RendererBase<Categorization> {
self.renderSimpleVariable(c, remainingNames, 'bool'),
getBool: (CT_ c) => c.hasCategoryNames == true,
),
'hasDisplayedCategories': Property(
getValue: (CT_ c) => c.hasDisplayedCategories,
renderVariable: (CT_ c, Property<CT_> self,
List<String> remainingNames) =>
self.renderSimpleVariable(c, remainingNames, 'bool'),
getBool: (CT_ c) => c.hasDisplayedCategories == true,
),
'hasImage': Property(
getValue: (CT_ c) => c.hasImage,
renderVariable: (CT_ c, Property<CT_> self,
Expand Down
2 changes: 0 additions & 2 deletions lib/src/model/categorization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,6 @@ abstract class Categorization implements ModelElement {
return categories.where((c) => c.isDocumented);
}

bool get hasDisplayedCategories => displayedCategories.isNotEmpty;

/// True if categories, subcategories, a documentation icon, or samples were
/// declared.
bool get hasCategorization {
Expand Down
1 change: 1 addition & 0 deletions lib/src/model/operator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ class Operator extends Method {
'<=': 'less_equal',
'<<': 'shift_left',
'>>': 'shift_right',
'>>>': 'triple_shift',
'^': 'bitwise_exclusive_or',
'unary-': 'unary_minus',
'|': 'bitwise_or',
Expand Down
2 changes: 1 addition & 1 deletion lib/templates/html/_sidebar_for_category.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
{{/self.hasPublicLibraries}}

{{#self.hasPublicMixins}}
<li class="section-title"><a href="{{{library.href}}}#mixins">Mixins</a></li>
<li class="section-title"><a href="{{{self.href}}}#mixins">Mixins</a></li>
{{#self.publicMixinsSorted}}
<li>{{{ linkedName }}}</li>
{{/self.publicMixinsSorted}}
Expand Down
4 changes: 2 additions & 2 deletions lib/templates/md/_categorization.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{{#hasDisplayedCategories}}
{{#hasCategoryNames}}
Categories:
{{#displayedCategories}}
{{{categoryLabel}}}
{{/displayedCategories}}
{{/hasDisplayedCategories}}
{{/hasCategoryNames}}
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ environment:
sdk: '>=2.11.99 <3.0.0'

dependencies:
analyzer: ^1.3.0
analyzer: ^1.4.0
args: ^2.0.0
charcode: ^1.2.0
collection: ^1.2.0
Expand Down
94 changes: 55 additions & 39 deletions test/end2end/dartdoc_integration_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,20 @@ void main() {
test('invalid parameters return non-zero and print a fatal-error',
() async {
var outputLines = <String>[];
await expectLater(
() => subprocessLauncher.runStreamed(
Platform.resolvedExecutable,
[
dartdocPath,
'--nonexisting',
],
perLine: outputLines.add),
throwsA(const TypeMatcher<ProcessException>()));
var threwException = false;
// consider [expectLater] when it works reliably with coverage again.
try {
await subprocessLauncher.runStreamed(
Platform.resolvedExecutable,
[
dartdocPath,
'--nonexisting',
],
perLine: outputLines.add);
} on ProcessException {
threwException = true;
}
expect(threwException, isTrue);
expect(
outputLines.firstWhere((l) => l.startsWith(' fatal')),
equals(
Expand All @@ -109,31 +114,41 @@ void main() {
test('missing a required file path prints a fatal-error', () async {
var outputLines = <String>[];
var impossiblePath = path.join(dartdocPath, 'impossible');
await expectLater(
() => subprocessLauncher.runStreamed(
Platform.resolvedExecutable,
[
dartdocPath,
'--input',
impossiblePath,
],
perLine: outputLines.add),
throwsA(const TypeMatcher<ProcessException>()));
var threwException = false;
// consider [expectLater] when it works with coverage again.
try {
await subprocessLauncher.runStreamed(
Platform.resolvedExecutable,
[
dartdocPath,
'--input',
impossiblePath,
],
perLine: outputLines.add);
} on ProcessException {
threwException = true;
}
expect(threwException, isTrue);
expect(
outputLines.firstWhere((l) => l.startsWith(' fatal')),
startsWith(
' fatal error: Argument --input, set to $impossiblePath, resolves to missing path: '));
});

test('errors cause non-zero exit when warnings are off', () async {
expect(
() => subprocessLauncher.runStreamed(Platform.resolvedExecutable, [
dartdocPath,
'--allow-tools',
'--input=${testPackageToolError.path}',
'--output=${path.join(tempDir.absolute.path, 'test_package_tool_error')}'
]),
throwsA(const TypeMatcher<ProcessException>()));
// consider [expectLater] when it works with coverage.
var exceptionThrown = false;
try {
await subprocessLauncher.runStreamed(Platform.resolvedExecutable, [
dartdocPath,
'--allow-tools',
'--input=${testPackageToolError.path}',
'--output=${path.join(tempDir.absolute.path, 'test_package_tool_error')}'
]);
} on ProcessException {
exceptionThrown = true;
}
expect(exceptionThrown, isTrue);
});

test('help prints command line args', () async {
Expand All @@ -156,19 +171,20 @@ void main() {
var dartTool =
Directory(path.join(_testPackageFlutterPluginPath, '.dart_tool'));
if (dartTool.existsSync()) dartTool.deleteSync(recursive: true);
Future run = subprocessLauncher.runStreamed(
Platform.resolvedExecutable, args,
environment: Map.from(Platform.environment)..remove('FLUTTER_ROOT'),
includeParentEnvironment: false,
workingDirectory: _testPackageFlutterPluginPath, perLine: (s) {
output.writeln(s);
});
// Asynchronous exception, but we still need the output, too.
expect(run, throwsA(TypeMatcher<ProcessException>()));
var exceptionThrown = false;
// consider [expectLater] when this works with coverage
try {
await run;
} on ProcessException catch (_) {}

await subprocessLauncher.runStreamed(Platform.resolvedExecutable, args,
environment: Map.from(Platform.environment)..remove('FLUTTER_ROOT'),
includeParentEnvironment: false,
workingDirectory: _testPackageFlutterPluginPath, perLine: (s) {
output.writeln(s);
});
} on ProcessException {
exceptionThrown = true;
}
// Asynchronous exception, but we still need the output, too.
expect(exceptionThrown, isTrue);
expect(
output.toString(),
contains(RegExp(
Expand Down
20 changes: 10 additions & 10 deletions test/end2end/model_special_cases_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,10 @@ final Version _platformVersion = Version.parse(_platformVersionString);
final _testPackageGraphExperimentsMemo = AsyncMemoizer<PackageGraph>();
Future<PackageGraph> get _testPackageGraphExperiments =>
_testPackageGraphExperimentsMemo.runOnce(() => utils.bootBasicPackage(
'testing/test_package_experiments',
pubPackageMetaProvider,
PhysicalPackageConfigProvider(),
additionalArguments: [
'--enable-experiment',
'non-nullable,nonfunction-type-aliases',
'--no-link-to-remote'
]));
'testing/test_package_experiments',
pubPackageMetaProvider,
PhysicalPackageConfigProvider(),
additionalArguments: ['--no-link-to-remote']));

final _testPackageGraphGinormousMemo = AsyncMemoizer<PackageGraph>();
Future<PackageGraph> get _testPackageGraphGinormous =>
Expand Down Expand Up @@ -74,12 +70,16 @@ void main() {
exit(1);
}

// We can not use ExperimentalFeature.releaseVersion or even
// ExperimentalFeature.experimentalReleaseVersion as these are set to null
// even when partial analyzer implementations are available, and are often
// set too high after release.
final _generalizedTypedefsAllowed =
VersionRange(min: Version.parse('2.13.0-0'), includeMin: true);
final _genericMetadataAllowed =
VersionRange(min: Version.parse('2.13.0-0'), includeMin: true);
VersionRange(min: Version.parse('2.15.0-0'), includeMin: true);
final _tripleShiftAllowed =
VersionRange(min: Version.parse('2.13.0-0'), includeMin: true);
VersionRange(min: Version.parse('2.15.0-0'), includeMin: true);

// Experimental features not yet enabled by default. Move tests out of this
// block when the feature is enabled by default.
Expand Down
2 changes: 1 addition & 1 deletion testing/test_package_experiments/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name: test_package_experiments
version: 0.0.1
environment:
sdk: '>=2.13.0-0 <3.0.0'
sdk: '>=2.14.0-0 <3.0.0'
description: Experimental flags are tested here.

0 comments on commit 3ce8e21

Please sign in to comment.