technojosh has asked for the wisdom of the Perl Monks concerning the following question:
I have made it through some of the perlxstut examples, and my question is in regards to testing the XS module using 'dmake test'...
The idea was to make a test script to run 4 test cases on a simple XS module with a method called 'is_even' that takes an int and returns true if it is even.
My current "Mytest.t" looks like this:
use Test::More tests => 4; BEGIN {use_ok('Mytest')} print &Mytest::is_even(0) == 1 ? "ok 2" : "not ok 2", "\n"; print &Mytest::is_even(1) == 0 ? "ok 3" : "not ok 3", "\n"; print &Mytest::is_even(2) == 1 ? "ok 4" : "not ok 4", "\n";
now when I run 'dmake test', I get the error message:
Looks like you planned 4 tests but only ran 1
The perlxstut says to modify the BEGIN block to "print 1..4", but anything I change in the BEGIN block leads to syntax errors.
I'm sure I am missing something very easy here, what am I doing wrong with the BEGIN block of my test code?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Testing a XS module
by chargrill (Parson) on Aug 29, 2007 at 16:31 UTC | |
|
Re: Testing a XS module
by ikegami (Patriarch) on Aug 29, 2007 at 16:36 UTC | |
by technojosh (Priest) on Aug 29, 2007 at 19:29 UTC | |
|
Re: Testing a XS module
by andyford (Curate) on Aug 29, 2007 at 16:37 UTC |