Skip to content

Commit 11fe7c4

Browse files
author
Jan-Olof Hendig
committed
Improved code formatting
1 parent 3625f54 commit 11fe7c4

File tree

1 file changed

+18
-18
lines changed

1 file changed

+18
-18
lines changed

doc/Language/testing.pod6

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,15 @@ project's base directory.
121121
A typical test file looks something like this:
122122
123123
=begin code :skip-test
124-
use v6.c;
125-
use Test; # a Standard module included with Rakudo
126-
use lib 'lib';
124+
use v6.c;
125+
use Test; # a Standard module included with Rakudo
126+
use lib 'lib';
127127
128-
plan $num-tests;
128+
plan $num-tests;
129129
130-
# .... tests
130+
# .... tests
131131
132-
done-testing; # optional with 'plan'
132+
done-testing; # optional with 'plan'
133133
=end code
134134
135135
We ensure that we're using Perl 6, via the C<use v6.c> pragma, then we load
@@ -156,19 +156,19 @@ Tests can be run individually by specifying the test filename on the
156156
command line:
157157
158158
=for code :lang<shell>
159-
$ perl6 t/test-filename.t
159+
$ perl6 t/test-filename.t
160160
161161
Or via the L<prove|http://perldoc.perl.org/prove.html> command from Perl 5,
162162
where C<perl6> is specified as the executable that runs the tests:
163163
164164
=for code :lang<shell>
165-
$ prove --exec perl6 -r t
165+
$ prove --exec perl6 -r t
166166
167167
To abort the test suite upon first failure, set the
168168
C<PERL6_TEST_DIE_ON_FAIL> environmental variable:
169169
170170
=for code :lang<shell>
171-
$ PERL6_TEST_DIE_ON_FAIL=1 perl6 t/test-filename.t
171+
$ PERL6_TEST_DIE_ON_FAIL=1 perl6 t/test-filename.t
172172
173173
The same variable can be used within the test file. Set it before loading
174174
the C<Test> module:
@@ -404,7 +404,7 @@ and the test will fail if C<rel-diff> is higher than C<$rel-tol>.
404404
=head3 Both Absolute and Relative Tolerance Specified
405405
406406
=for code :skip-test
407-
is-approx $value, $expected, :rel-tol<.5>, :abs-tol<10>;
407+
is-approx $value, $expected, :rel-tol<.5>, :abs-tol<10>;
408408
409409
When both absolute and relative tolerances are specified, each will be
410410
tested independently, and the C<is-approx> test will succeed only if both pass.
@@ -704,12 +704,12 @@ only one test will be marked TODO.
704704
The result from the test code above will be something like:
705705
706706
=begin code :lang<TAP>
707-
not ok 1 - my-custom-pi# TODO not yet precise enough
707+
not ok 1 - my-custom-pi# TODO not yet precise enough
708708
709-
# Failed test 'my-custom-pi'
710-
# at test-todo.t line 7
711-
# expected: '3.14159265358979'
712-
# got: '3'
709+
# Failed test 'my-custom-pi'
710+
# at test-todo.t line 7
711+
# expected: '3.14159265358979'
712+
# got: '3'
713713
=end code
714714
715715
Note that if you C<todo> a C<subtest>, all of the failing tests inside of it will be
@@ -770,9 +770,9 @@ If you already know the tests will fail, you can bail out of the test run
770770
using C<bail-out()>:
771771
772772
=begin code
773-
my $has-db-connection;
774-
...
775-
$has-db-connection or bail-out 'Must have database connection for testing';
773+
my $has-db-connection;
774+
...
775+
$has-db-connection or bail-out 'Must have database connection for testing';
776776
=end code
777777
778778
The function aborts the current test run, signaling failure to the harness.

0 commit comments

Comments
 (0)