Skip to content

Commit 93a75ee

Browse files
committed
clean up test descriptions
1 parent fa2baa1 commit 93a75ee

File tree

2 files changed

+22
-6
lines changed

2 files changed

+22
-6
lines changed

doc/Type/Bool.rakudoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ the "lowest" Bool enum value, its own predecessor is also C<False>.
7070

7171
method enums(--> Hash:D)
7272

73-
Returns a L<Hash|/type/Hash> of enum-pairs. Works on both the C<Bool> type
73+
Returns a L<Hash|/type/Hash> of enum-pairs. Works on both the L<C<Bool>|/type/Bool> type
7474
and any key.
7575

7676
say Bool.enums; # OUTPUT: «{False => 0, True => 1}␤»

xt/rakudoc-types.rakutest

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@ if @files {
2626
plan :skip-all<No rakudoc files specified>
2727
}
2828

29+
sub render-node($node) {
30+
my $type = $node.contents.join('');
31+
my $result = $node.type ~ '<' ~ $type;
32+
if $node.type eq 'L' {
33+
$result ~= '|' ~ $node.meta
34+
}
35+
$result ~= '>';
36+
37+
$result;
38+
}
39+
2940
sub is-valid-type($node, $parent) {
3041
# only care about I<>, C<>, L<>, etc.
3142
return unless $node ~~ Pod::FormattingCode;
@@ -34,25 +45,29 @@ sub is-valid-type($node, $parent) {
3445
my $type = $node.contents.join('').subst('::','/', :g);
3546
return unless "doc/Type/$type.rakudoc".IO.f;
3647

48+
# Might be nested but we only report on the innermost here.
3749
if $node.type ne 'C' {
38-
flunk $node.type ~ '<' ~ $type ~ "> should be L<C<$type>|/type/$type>";
50+
flunk "{render-node($node)} should be L<C<$type>|/type/$type>";
3951
return;
4052
}
4153

54+
# Probably in a paragraph
4255
if $parent === Nil or ! ($parent ~~ Pod::FormattingCode) {
43-
flunk $node.type ~ '<' ~ $type ~ "> should be L<C<$type>|/type/$type> - bad parent class: {$parent.^name}";
56+
flunk "{render-node($node)} should be L<C<$type>|/type/$type>";
4457
return;
4558
}
4659

60+
# Wrapped, but not in an L<>
4761
if $parent.type ne 'L' {
48-
flunk $parent.type ~ '<C<' ~ $type ~ ">> should be L<C<$type>|/type/$type> - bad parent FormattingCode";
62+
flunk "$parent.type<{render-node($node)}> should be L<C<$type>|/type/$type> - bad parent FormattingCode";
4963
return;
5064
} elsif $parent.meta ne "/type/$type" {
51-
flunk 'L<C<' ~ $type ~ '|' ~ $parent.meta~ ">> should be L<C<$type>|/type/$type> - bad link";
65+
# Wrapped in an L<> but wrong URL
66+
flunk "L<{render-node($node)}|$parent.meta> should be L<C<$type>|/type/$type> - bad link";
5267
} else {
68+
# \o/
5369
pass "$type reference correctly formatted.";
5470
}
55-
5671
}
5772

5873
sub walk-content($item, $parent) {
@@ -64,6 +79,7 @@ sub walk-content($item, $parent) {
6479
}
6580
}
6681

82+
# Walk through pod on each file.
6783
for @files -> $file {
6884
my @chunks = extract-pod($file).contents;
6985

0 commit comments

Comments
 (0)