Skip to content

Add a prefixes test for prefix references #3837

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 51 additions & 0 deletions test/prefixes_test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright (c) 2024, 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:test/test.dart';
import 'package:test_reflective_loader/test_reflective_loader.dart';

import 'dartdoc_test_base.dart';
import 'src/utils.dart';

void main() {
defineReflectiveSuite(() {
defineReflectiveTests(PrefixesTest);
});
}

@reflectiveTest
class PrefixesTest extends DartdocTestBase {
@override
String get libraryName => 'prefixes';

void test_referenced() async {
var library = await bootPackageWithLibrary(
'''
import 'dart:async' as async;

/// Text [async].
int x = 0;
''',
additionalArguments: ['--link-to-remote'],
);
var f = library.properties.named('x');
// There is no link, but also no wrong link or crash.
expect(f.documentationAsHtml, '<p>Text <code>async</code>.</p>');
}

void test_referenced_wildcard() async {
var library = await bootPackageWithLibrary(
'''
import 'dart:async' as _;

/// Text [_].
int x = 0;
''',
additionalArguments: ['--link-to-remote'],
);
var f = library.properties.named('x');
// There is no link, but also no wrong link or crash.
expect(f.documentationAsHtml, '<p>Text <code>_</code>.</p>');
}
}