Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

HOWTO give options to parrot in tests

5 views
Skip to first unread message

Karl Forner

unread,
Sep 14, 2006, 7:42:41 PM9/14/06
to Internals List
Hi,

I'm currently trying to implement [#40064: [TODO] shootout example testing].

Because the PIR shootout scripts are run with specific options, I must be
able
to run the script with these options that I can get by parsing the she-bang
line.

But by looking in other tests and in the Parrot::Test, it seems that the
canonical way
of running a PIR script is through the example_output_is() function.
BUT this function does not take any arguments for Parrot.

By looking again in the code I figured out that maybe I could use the
TEST_PROG_ARGS env var
(if the script name does not match "opt").
But it is undocumented and not very robust, so What Should I do ?

Thanks,

Karl Forner

Leopold Toetsch

unread,
Sep 15, 2006, 4:53:37 AM9/15/06
to perl6-i...@perl.org
Am Freitag, 15. September 2006 01:42 schrieb Karl Forner:
> But by looking in other tests and in the Parrot::Test, it seems that the
> canonical way
> of running a PIR script is through the example_output_is() function.
> BUT this function does not take any arguments for Parrot.

I'd subclass Parrot::Test and create a function shootout_output_is(), which
takes an extra commandline argument.

leo

Karl Forner

unread,
Sep 17, 2006, 9:16:42 AM9/17/06
to Leopold Toetsch, perl6-i...@perl.org


Hmmm but if I subclass Parrot::Test, I won't be able to reuse any code. So
if by instance the multiplatform way of getting the path
to the parrot interpreter changes, I will have to synchronyze the code in
the subclass too. Isn't it evil ?


By the way, I have implemented the test using the TEST_PROG_ARGS environment
variable.
It is not very elegant but at least it seems to work for now.

Leopold Toetsch

unread,
Sep 17, 2006, 10:48:51 AM9/17/06
to perl6-i...@perl.org
Am Sonntag, 17. September 2006 15:16 schrieb Karl Forner:
> > I'd subclass Parrot::Test and create a function shootout_output_is(),
> > which
> > takes an extra commandline argument.
>
> Hmmm but if I subclass Parrot::Test, I won't be able to reuse any code.

There are already Test classes: see lib/Parrot/Test/*.pm. If there's anything
wrong with code reusablility, this should be fixed ;)

leo

0 new messages