Skip to content

Commit 997cafb

Browse files
committed
Mark snippets from other languages
Only test Perl 6.
1 parent 4fa84d0 commit 997cafb

File tree

3 files changed

+12
-2
lines changed

3 files changed

+12
-2
lines changed

CONTRIBUTING.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,13 @@ for a file. Use the pod-config option `skip-test` to skip them.
128128
your-example-here();
129129
=end code
130130

131+
In other cases, the snippet of code isn't Perl 6; in that case, mark the
132+
language, which will also skip the test.
133+
134+
=begin code :lang<tcl>
135+
puts "this is not Perl"
136+
=end code
137+
131138
### Catching expected exception
132139

133140
Some tests will throw exceptions that would stop the execution of the extracted

doc/Language/traps.pod6

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ Instead, use an expression that produces a value when you want a value.
195195
In Perl 5 one could reference the last element of an array by asking for the
196196
"-1th" element of the array, e.g.:
197197
198-
=for code :skip-test<perl5>
198+
=for code :lang<perl5>
199199
my @array = qw{victor alice bob charlie eve};
200200
say @array[-1]; # OUTPUT: «eve␤»
201201

xt/examples-compilation.t

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,13 @@ my $counts = BagHash.new;
5757
for @files -> $file {
5858
for extract-pod($file.IO).contents -> $chunk {
5959
if $chunk ~~ Pod::Block::Code {
60+
if $chunk.config<lang> && $chunk.config<lang> ne 'perl6' {
61+
next; # Only testing Perl 6 snippets.
62+
}
6063
my $todo = False;
6164
if $chunk.config<skip-test> {
6265
%*ENV<P6_DOC_TEST_FUDGE> ?? ($todo = True) !! next;
63-
}
66+
}
6467
@examples.push: %(
6568
'contents', $chunk.contents.map({walk $_}).join,
6669
'file', $file,

0 commit comments

Comments
 (0)