|
| 1 | +// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file |
| 2 | +// for details. All rights reserved. Use of this source code is governed by a |
| 3 | +// BSD-style license that can be found in the LICENSE file. |
| 4 | + |
| 5 | +import 'package:test/test.dart'; |
| 6 | +import 'package:test_reflective_loader/test_reflective_loader.dart'; |
| 7 | + |
| 8 | +import 'dartdoc_test_base.dart'; |
| 9 | +import 'src/utils.dart'; |
| 10 | + |
| 11 | +void main() { |
| 12 | + defineReflectiveSuite(() { |
| 13 | + defineReflectiveTests(PrefixesTest); |
| 14 | + }); |
| 15 | +} |
| 16 | + |
| 17 | +@reflectiveTest |
| 18 | +class PrefixesTest extends DartdocTestBase { |
| 19 | + @override |
| 20 | + String get libraryName => 'prefixes'; |
| 21 | + |
| 22 | + void test_referenced() async { |
| 23 | + var library = await bootPackageWithLibrary( |
| 24 | + ''' |
| 25 | +import 'dart:async' as async; |
| 26 | +
|
| 27 | +/// Text [async]. |
| 28 | +int x = 0; |
| 29 | +''', |
| 30 | + additionalArguments: ['--link-to-remote'], |
| 31 | + ); |
| 32 | + var f = library.properties.named('x'); |
| 33 | + // There is no link, but also no wrong link or crash. |
| 34 | + expect(f.documentationAsHtml, '<p>Text <code>async</code>.</p>'); |
| 35 | + } |
| 36 | + |
| 37 | + void test_referenced_wildcard() async { |
| 38 | + var library = await bootPackageWithLibrary( |
| 39 | + ''' |
| 40 | +import 'dart:async' as _; |
| 41 | +
|
| 42 | +/// Text [_]. |
| 43 | +int x = 0; |
| 44 | +''', |
| 45 | + additionalArguments: ['--link-to-remote'], |
| 46 | + ); |
| 47 | + var f = library.properties.named('x'); |
| 48 | + // There is no link, but also no wrong link or crash. |
| 49 | + expect(f.documentationAsHtml, '<p>Text <code>_</code>.</p>'); |
| 50 | + } |
| 51 | +} |
0 commit comments