Skip to content

Commit

Permalink
Add a prefixes test for prefix references (#3837)
Browse files Browse the repository at this point in the history
  • Loading branch information
srawlins authored Aug 20, 2024
1 parent 0577ca1 commit 9bf90e5
Showing 1 changed file with 51 additions and 0 deletions.
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>');
}
}

0 comments on commit 9bf90e5

Please sign in to comment.