Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

The functions that Test::More exports are already somewhat closer to "english", as it exports is ("smart" equality), like (regex matching), and even is_deeply (equality for arrays).

I guess an "informal" specification could to go a route of first defining Perl equivalents for some expressions and then simply translating some simplicistic sentences into Perl, possibly like the following:

=for test_description Description: The foo parameter contains valid data. Definitions: The foo parameter is stored in $foo. Criteria: The foo parameter is not empty and The foo parameter is defined and The foo parameter matches the pattern C</bar/>. =cut

This could ("easily") be compiled into the following Perl code:

my %test; my $foo; $test{Description} = qw(The foo parameter contains valid data); # The foo parameter is stored in $foo. $test{access} = [ \$foo ]; # The foo parameter is not empty and for my $t (@{$test{access}}) { isnt( $t, '', $test{Description} . qw(The foo parameter is not empty)) +; # The foo parameter is defined and is( $t, defined, $test{Description} . qw(The foo parameter is defined) +); # The foo parameter matches the pattern C</bar/>. like( $t, qr/bar/, $test{Description} . qw(The foo parameter matches C +</bar/>)); };

As long as you restrict yourself to this simple vocabulary, this would do the job, and possibly you will want to create "macros" that allow you a higher-level description of the specifications. But I think that describing the single tests in english dosen't buy you much in the sense of readability and understanding, as it dosen't describe the "top view" but only the single small steps towards the main goal.

In reply to Re: Testing: Fun for the family by Corion
in thread Testing: Fun for the family by BUU

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others browsing the Monastery: (4)
    As of 2018-05-25 04:08 GMT
    Find Nodes?
      Voting Booth?