I haven't used either Test::Spec or Test::Class previously. I managed to get these interacting at a very basic level: calling Test::Class::->runtests; from within a Test::Spec it() function.

The main script:

ken@ganymede: ~/tmp $ cat pm_class_spec_comb.pl #!/usr/bin/env perl use strict; use warnings; use Test::Spec; use Test::Class::Example::Hello::Tests; it 'runs Test::Spec and Test::Class tests' => sub { diag('Hello, world! (from Test::More::diag() as: diag())'); print qq{Hello, world! (from Test::Spec::it() as: it CODE\n}; Test::Class::->runtests; diag('Last it() statement.'); }; runtests unless caller;

The Test::Class::Example::Hello::Tests module:

ken@ganymede: ~/tmp/Test/Class/Example/Hello $ cat Tests.pm package Test::Class::Example::Hello::Tests; use base 'Test::Class'; sub test_Hello : Test { print qq{Hello, world! (from Test::Class as: sub test_Hello : Test +\n}; return 1; } 1;

Sample run:

$ pm_class_spec_comb.pl # Hello, world! (from Test::More::diag() as: diag()) Hello, world! (from Test::Spec::it() as: it CODE 1..1 Hello, world! (from Test::Class as: sub test_Hello : Test ok 1 # skip 1 # Last it() statement.

I'll leave you to experiment further.

-- Ken


In reply to Re: Test::Class with Test::Spec's sugar ? by kcott
in thread Test::Class with Test::Spec's sugar ? by mascip

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.