Skip to content

Commit f5c3fe5

Browse files
committed
GH #18163: Stricter, cleaned up test example:
This just adds 'my $i' to make the test pass on strict, and it cleans it up and provides test names for the tests. I kept the tabs that were used.
1 parent 54fc8aa commit f5c3fe5

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

dist/ExtUtils-ParseXS/lib/perlxstut.pod

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -395,11 +395,27 @@ Edit the Makefile.PL file so that the corresponding line looks like this:
395395
Generate the Makefile and run make. Change the test number in Mytest.t to
396396
"9" and add the following tests:
397397

398-
$i = -1.5; &Mytest::round($i); is( $i, -2.0 );
399-
$i = -1.1; &Mytest::round($i); is( $i, -1.0 );
400-
$i = 0.0; &Mytest::round($i); is( $i, 0.0 );
401-
$i = 0.5; &Mytest::round($i); is( $i, 1.0 );
402-
$i = 1.2; &Mytest::round($i); is( $i, 1.0 );
398+
my $i;
399+
400+
$i = -1.5
401+
&Mytest::round($i)
402+
is( $i, -2.0, 'Rounding -1.5 to -2.0' );
403+
404+
$i = -1.1
405+
&Mytest::round($i)
406+
is( $i, -1.0, 'Rounding -1.1 to -1.0' );
407+
408+
$i = 0.0
409+
&Mytest::round($i)
410+
is( $i, 0.0, 'Rounding 0.0 to 0.0' );
411+
412+
$i = 0.5
413+
&Mytest::round($i)
414+
is( $i, 1.0, 'Rounding 0.5 to 1.0' );
415+
416+
$i = 1.2
417+
&Mytest::round($i)
418+
is( $i, 1.0, 'Rounding 1.2 to 1.0' );
403419

404420
Running "C<make test>" should now print out that all nine tests are okay.
405421

0 commit comments

Comments
 (0)