ghenry has asked for the wisdom of the Perl Monks concerning the following question:
Dear Monks,
I am doing my first set of tests before I start writing my module code, and I am trying out Test::File
The docs say the format of the test is:
file_exists_ok( FILENAME [, NAME ] )
So I have a wee test:
#!/usr/bin/perl use warnings; use strict; use Test::More tests => 1; use Test::File; my $filename = '/etc/doesnt_exist.conf'; my $name = 'doesnt_exist.conf'; file_exists_ok( $filename [, $name ] );
But I get:
[root@dev1 perl]# perl test-file 1..1 Multidimensional syntax $filename [, $name ] not supported at test-fil +e line 10.Global symbol "@filename" requires explicit package name at + test-file line 10. syntax error at test-file line 10, near "[," Execution of test-file aborted due to compilation errors. # Looks like your test died before it could output anything.
So abviously, the docs need to be changed to reflect the format?
So changing this to:
It's works, as it can see it's not there, but I get:#!/usr/bin/perl use warnings; use strict; use Test::More tests => 1; use Test::File; my $filename = '/etc/doesnt_exist.conf'; my $name = 'doesnt_exist.conf'; file_exists_ok( $filename, [ $name ] );
[root@dev1 perl]# perl test-file 1..1 # File [/etc/doesnt_exist.conf] does not exist Invalid value for shared scalar at /usr/lib/perl5/5.8.6/Test/Builder.p +m line 319. WHOA! Somehow you got a different number of results than tests ran! This should never happen! Please contact the author immediately! END failed--call queue aborted.
I have tested this with 5.8.0 and 5.8.6
Any ideas?
Thanks,
Gavin.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Test::File - Don't understand the docs very well
by castaway (Parson) on Sep 16, 2005 at 08:26 UTC | |
by ghenry (Vicar) on Sep 16, 2005 at 08:33 UTC |