> > output_is(<<'CODE', <<'OUT', "Simple Floats"); > > print 4.5; > > print 0.0; > > print 13.12343 > > CODE > > 4.50.013.12343 > > OUT > > > >I'd be more comfortable with a newline between the numbers, just in case. It's > >not an issue in the string tests. > > Alright, fine by me; I was wondering on that myself. Done & Updated.
When I look at this, I find myself wanting to separate the control from the data. Here's an alternative: my @input = qw( 4.5 0.0 13.12343 ); my @output = qw( 4.5 0.0 13.12343 ); # can't assume that input==output my $code = join(";", map {"print $_"} @input); my $expect = join( "", @output); output_is($code, $expect, "Simple Floats"); This is, perhaps, slightly harder to grok initially. But its easier to extend the test data; and also to make control-path changes (such as added the \n to the print statement). It might be better to use a hash for the test data. It is possible to make this type of test much easier to read. A mechanism I have used in the past is to put the test data into a table (I used html). Then, you have the test data and expected output as a nice table in a document; and a simple piece of code to extract tests from it (assuming you use a perl5 module to parse the table). Dave.