On Thu, Feb 05, 2009 at 02:51:54PM +0100, Uwe Voelker wrote:
> 
> Hello,
> 
> with commit #680 I created t/lib/NYTProfTest.pm and gave each test its 
> own .t file.

Great! Many thanks Uwe.

I've just made a slight tweak for test16.t with perl < 5.10
http://code.google.com/p/perl-devel-nytprof/source/detail?r=681

> Now I would like to change the following:
> Each .t file can contain the contents of the separate files .p, .rdt and 
> .x as file sections (__PERL__, __TSV__, __CSV__).
> 
> This way (some) tests can be combined to a single file.
> 
> What do you think?

I don't see much value. Especially as it would mangle the line numbers
of the perl code. I'm happy for them to stay as separate files.

What's needed now is a way for a .t file to specify ordinary perl tests,
so we can test things that don't fit into the "dump and diff" model we
currently use.

One tricky issue is that the test are run with various combinations of
NYTPROF env var options, so we'd want to do the same with an extra tests
we write.

So I was thinking of something along these lines:

    run_test_group(2 => sub {
        my ($profile, $env) = @_;
        is $profile->foo, 'bar', "...";
        is $profile->baz, 'bax', "...";
    });

where the 2 is the number of tests in the code ref (because it would be
nice to stop using no_plan at some point in the future).

What do you think?

Tim.

p.s. While I don't see much value in __TSV__ etc, I can see some value
for an easy way to profile and test really short snippets of code.
So a simple function may be useful:

    profile_and_test_this(q{ perl code }, 42 => sub {);
        my ($profile, $env) = @_;
        is $profile->foo, 'bar', ...
        ...
    });

That would also lay the foundations for __TSV__ etc if we choose to add
it in the future.

--~--~---------~--~----~------------~-------~--~----~
You've received this message because you are subscribed to
the Devel::NYTProf Development User group.

Group hosted at:  http://groups.google.com/group/develnytprof-dev
Project hosted at:  http://perl-devel-nytprof.googlecode.com
CPAN distribution:  http://search.cpan.org/dist/Devel-NYTProf

To post, email:  [email protected]
To unsubscribe, email:  [email protected]
-~----------~----~----~----~------~----~------~--~---

Reply via email to