in reply to Re^4: How to write testable command line script?
in thread How to write testable command line script?
Oh! Silly me. You call:
main('90 35 29 + 90 24 29')
But main is:
sub main { reduce(@ARGV); }
so reduce doesn't see the parameters passed to main, it sees @ARGV which is empty. Change main to:
sub main { reduce(@_); }
Also:
In this case "the whole" is a trivial wrapper around reduce so I'd go for testing reduce directly - a unit test.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^6: How to write testable command line script?
by thechartist (Monk) on Nov 21, 2018 at 03:31 UTC | |
by AnomalousMonk (Archbishop) on Nov 21, 2018 at 03:46 UTC | |
by thechartist (Monk) on Nov 21, 2018 at 04:02 UTC |