# through perltidy should read/write identical contents (previously only
# file test behaved correctly)
+# Test::More in perl versions before 5.10 does not have sub note
+# so just skip this test
+
plan( tests => 6 );
test_all();
+sub my_note {
+ my ($msg) = @_;
+
+ # try to work around problem where sub Test::More::note does not exist
+ # in older versions of perl
+ if ($] >= 5.010) {
+ note($msg);
+ }
+ return;
+}
+
+
sub test_all {
my $test_file = "$Bin/testwide-passthrough.pl.src";
test_file2file($test_file);
my $source = $test_file;
my $destination = $tmp_file->filename();
- note("Testing file2file: '$source' => '$destination'\n");
+ my_note("Testing file2file: '$source' => '$destination'\n");
my $tidyresult = Perl::Tidy::perltidy(
argv => '-utf8 -npro',
my $source_hex = unpack( 'H*', $source_str );
my $destination_hex = unpack( 'H*', $destination_str );
- note("Comparing contents:\n $source_hex\n $destination_hex\n");
+ my_note("Comparing contents:\n $source_hex\n $destination_hex\n");
ok( $source_hex eq $destination_hex, 'file content compare' );
}
my $source = slurp_raw($testfile);
my $destination;
- note("Testing scalar2scalar\n");
+ my_note("Testing scalar2scalar\n");
my $tidyresult = Perl::Tidy::perltidy(
argv => '-utf8 -eos -npro',
my $source_hex = unpack( 'H*', $source );
my $destination_hex = unpack( 'H*', $destination );
- note("Comparing contents:\n $source_hex\n $destination_hex\n");
+ my_note("Comparing contents:\n $source_hex\n $destination_hex\n");
ok( $source_hex eq $destination_hex, 'scalar content compare' );
}
my $source = [ lines_raw($testfile) ];
my $destination = [];
- note("Testing scalararray2scalararray\n");
+ my_note("Testing scalararray2scalararray\n");
my $tidyresult = Perl::Tidy::perltidy(
argv => '-utf8 -eos -npro',
my $source_hex = unpack( 'H*', $source_str );
my $destination_hex = unpack( 'H*', $destination_str );
- note("Comparing contents:\n $source_hex\n $destination_hex\n");
+ my_note("Comparing contents:\n $source_hex\n $destination_hex\n");
ok( $source_hex eq $destination_hex, 'scalararray content compare' );
}