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:

#!/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 ] );
It's works, as it can see it's not there, but I get:
[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.

Walking the road to enlightenment... I found a penguin and a camel on the way.....
Fancy a yourname@perl.me.uk? Just ask!!!

In reply to Test::File - Don't understand the docs very well by ghenry

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.