Skip to content
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>');
}
}