Skip to content

Commit 679c478

Browse files
committed
replace _ names with hyphen ones
1 parent ac5f0a4 commit 679c478

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

lib/Language/testing.pod

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -135,15 +135,15 @@ else {
135135
}
136136
=end code
137137
138-
=item skip_rest($reason?)
138+
=item skip-rest($reason?)
139139
140140
Skip the remaining tests. If the remainder of the tests in the test file
141141
would all fail due to some condition, use this function to skip them,
142142
providing an optional C<$reason> as to why.
143143
144144
=begin code
145145
unless $location ~~ "Wimbledon Common" {
146-
skip_rest "We can't womble, the remaining tests will fail";
146+
skip-rest "We can't womble, the remaining tests will fail";
147147
exit;
148148
}
149149
@@ -152,8 +152,8 @@ ok(womble());
152152
# ...
153153
=end code
154154
155-
Note that C<skip_rest> requires a C<plan> to be set, otherwise the
156-
C<skip_rest> call will throw an error. If no plan was set, you can use
155+
Note that C<skip-rest> requires a C<plan> to be set, otherwise the
156+
C<skip-rest> call will throw an error. If no plan was set, you can use
157157
C<done> to indicate the end of the test run (though of course the test
158158
summary will not count skipped tests).
159159
@@ -199,14 +199,14 @@ optional C<$description> of the test.
199199
$a = Nil;
200200
isnt $a, Nil, 'Nil should not survive being put in a container';
201201
202-
=item cmp_ok($obtained, $comparison, $expected, $description?)
202+
=item cmp-ok($obtained, $comparison, $expected, $description?)
203203
204-
The C<cmp_ok()> function compares the C<$obtained> and C<$expected> values
204+
The C<cmp-ok()> function compares the C<$obtained> and C<$expected> values
205205
with the given C<$comparison> operator and passes the test if the comparison
206206
yields a C<True> value. For ease of use, operators may be passed as
207207
strings, such as C<'=='> or C<'~~'>.
208208
209-
cmp_ok('my spelling is apperling', '~~', /perl/, "bad speller");
209+
cmp-ok('my spelling is apperling', '~~', /perl/, "bad speller");
210210
211211
=head2 Matching output with a regular expression
212212
@@ -226,7 +226,7 @@ defined directly in the argument to C<unlike>.
226226
227227
=head2 Structural comparison with C<< infix:<eqv> >>
228228
229-
=item is_deeply($obtained, $expected, $description?)
229+
=item is-deeply($obtained, $expected, $description?)
230230
231231
Marks a test as passed if the C<$obtained> and C<$expected> values are
232232
C<eqv>. This is the best way to check for equality of (deep) data
@@ -248,26 +248,26 @@ my %expected =
248248
e => 3,
249249
c => 1,
250250
;
251-
is_deeply count-chars('fleece'), %expected, 'count-chars works on "fleece"';
251+
is-deeply count-chars('fleece'), %expected, 'count-chars works on "fleece"';
252252
=end code
253253
254254
Note that string comparison here would have been fragile, because hashes are
255255
not sorted, and converting a L<Hash|/type/Hash> to a string loses information.
256256
257257
=head2 Numeric comparison within a tolerance of 1e-5
258258
259-
=item is_approx($obtained, $expected, $description?)
259+
=item is-approx($obtained, $expected, $description?)
260260
261261
Marks a test as passed if the C<$obtained> and C<$expected> numerical values
262262
are within C<1e-5> of each other. The function accepts an optional
263263
C<$description> of the test.
264264
265265
my $eulers_constant_approx = 2.71828;
266-
is_approx($eulers_constant_approx, e, "approximate Euler's constant");
266+
is-approx($eulers_constant_approx, e, "approximate Euler's constant");
267267
268268
=head2 Class membership testing
269269
270-
=item isa_ok($object, $type, $description?)
270+
=item isa-ok($object, $type, $description?)
271271
272272
Marks a test as passed if the given C<$object> is, or inherits from, the
273273
given C<$type>. For convenience, types may also be specified as a string.
@@ -277,8 +277,8 @@ The function accepts an optional C<$description> of the test.
277277
class GreatUncleBulgaria is Womble {}
278278
279279
my $womble = GreatUncleBulgaria.new;
280-
isa_ok($womble, Womble, "Great Uncle Bulgaria is a womble");
281-
isa_ok($womble, 'Womble'); # equivalent
280+
isa-ok($womble, Womble, "Great Uncle Bulgaria is a womble");
281+
isa-ok($womble, 'Womble'); # equivalent
282282
283283
=head2 Grouping tests
284284
@@ -301,15 +301,15 @@ class GreatUncleBulgaria is Womble {
301301
302302
subtest {
303303
my $womble = GreatUncleBulgaria.new;
304-
isa_ok($womble, Womble, "Great Uncle Bulgaria is a womble");
304+
isa-ok($womble, Womble, "Great Uncle Bulgaria is a womble");
305305
is($womble->location, "Wimbledon Common", "Correct location");
306306
ok($womble->spectacles, "Wears spectacles");
307307
}, "Check Great Uncle Bulgaria";
308308
=end code
309309
310310
=head2 Exception testing
311311
312-
=item dies_ok($code, $description?)
312+
=item dies-ok($code, $description?)
313313
314314
Marks the test as passed if the given C<$code> throws an exception.
315315
@@ -320,10 +320,10 @@ sub saruman(Bool :$ents-destroy-isengard) {
320320
die "Killed by Wormtongue" if $ents-destroy-isengard;
321321
}
322322
323-
dies_ok { saruman(ents-destroy-isengard => True) }, "Saruman dies";
323+
dies-ok { saruman(ents-destroy-isengard => True) }, "Saruman dies";
324324
=end code
325325
326-
=item lives_ok($code, $description?)
326+
=item lives-ok($code, $description?)
327327
328328
Marks the test as passed if the given C<$code> B<does not> throw an
329329
exception.
@@ -335,38 +335,38 @@ sub frodo(Bool :$destroys-ring) {
335335
die "Oops, that wasn't supposed to happen" unless $destroys-ring;
336336
}
337337
338-
lives_ok { frodo(destroys-ring => True) }, "Frodo survivies";
338+
lives-ok { frodo(destroys-ring => True) }, "Frodo survivies";
339339
=end code
340340
341-
=item eval_dies_ok($code, $description?)
341+
=item eval-dies-ok($code, $description?)
342342
343343
Marks the test as passed if the given C<eval>ed C<$code> throws an
344344
exception.
345345
346346
The function accepts an optional C<$description> of the test.
347347
348348
=begin code
349-
eval_dies_ok q[my $joffrey = "nasty";
349+
eval-dies-ok q[my $joffrey = "nasty";
350350
die "bye bye Ned" if $joffrey ~~ /nasty/],
351351
"Ned Stark dies";
352352
=end code
353353
354-
=item eval_lives_ok
354+
=item eval-lives-ok
355355
356356
Marks the test as passed if the given C<eval>ed C<$code> throws an
357357
exception.
358358
359359
The function accepts an optional C<$description> of the test.
360360
361361
=begin code
362-
eval_lives_ok q[my $daenerys_burns = False;
362+
eval-lives-ok q[my $daenerys_burns = False;
363363
die "Oops, Khaleesi now ashes" if $daenerys_burns],
364364
"Dany is blood of the dragon";
365365
=end code
366366
367-
=item throws_like($code, $ex_type, $description?)
367+
=item throws-like($code, $ex_type, $description?)
368368
369-
The C<throws_like> function checks whether the given C<$code> (specified as
369+
The C<throws-like> function checks whether the given C<$code> (specified as
370370
either something C<Callable>, or as a something to be C<EVAL>led) throws a
371371
specific exception (either specified as a C<Type> object, or as a string).
372372
If an exception was thrown, it will also try to match the matcher hash, in
@@ -379,7 +379,7 @@ Please note that you can only use the C<EVAL> form if you are not referencing
379379
any symbols in the surrounding scope. If you are, you should encapsulate
380380
your string with a block and an EVAL. For instance:
381381
382-
throws_like { EVAL q[ fac("foo") ] }, X::TypeCheck::Argument;
382+
throws-like { EVAL q[ fac("foo") ] }, X::TypeCheck::Argument;
383383
384384
=end pod
385385

0 commit comments

Comments
 (0)