Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

comment on

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

Hi stevieb, test code is below. The dist in question is CMS::Drupal::Modules::MembershipEntity. As I mentioned I find it very odd since t/40_fetch_memberships.t failed whereas t/10_obj_and_params.t, t/20_valid_drupal.t, t/50_term_object_params.t and t/60_membership_object_params.t all passed. Also the error only occurred on Strawberry 5.14.3.

It really looks like the interpreter had a hiccup!

Error message:

Bareword "xception" not allowed while "strict subs" in use at C:/straw +berry5143/perl/vendor/lib/Test/Exception.pm line 4. Compilation failed in require at t/40_fetch_memberships.t line 14. BEGIN failed--compilation aborted at t/40_fetch_memberships.t line 14.

First 7 lines of Test/Exception.pm:

1: use strict; 2: use warnings; 3: 4: package Test::Exception; # <-- line cited in error message 5: use Test::Builder; 6: use Sub::Uplevel qw( uplevel ); 7: use base qw( Exporter );

This is t/40_fetch_memberships.t:

#! perl use strict; use warnings; BEGIN { ## Make sure we don't connect to our real DB if we ## have given the credentials for it $ENV{'DRUPAL_IGNORE_TEST_CREDS'} = 1; } use open ':std', ':encoding(utf8)'; use Test::More tests => 1; use Test::Group; use Test::Exception; # <-- line cited in error message use CMS::Drupal; use CMS::Drupal::Modules::MembershipEntity; use CMS::Drupal::Modules::MembershipEntity::Test; my $drupal = CMS::Drupal->new; my $dbh = build_test_db( $drupal ); my $ME = CMS::Drupal::Modules::MembershipEntity->new( dbh => $dbh +); subtest 'Feed various things to fetch_memberships()', sub { plan tests => 2; subtest 'Various arrays of valid mids', sub { plan tests => 10; for ( [], [3694], [3694, 2966], [3694, 2966, 42], [3302, 3358, 3414, 3470, 3530, 3582, 3638, 3694, 3750, 3948, + 3974, 4006, 4030, 4086], ) { my @array = @{ $_ }; my $hashref; lives_ok { $hashref = $ME->fetch_memberships( @array ) } 'Called fetch_memberships().'; my $cmp_data = build_test_data( @array ); test 'Data comparison with '. @array .' mids', sub { is( (scalar keys %{ $hashref }), (scalar keys %{ $cmp_data }), 'One item returned for each mid passed in' ); is_deeply($hashref, $cmp_data, 'Data matches' ); }; } }; subtest 'Various arrays with invalid mids', sub { plan tests => 4; for ( [3694, 'foo'], [3694, $ME], [3694, chr(0x263a)], [3694, sub { print "Hello, world\n" }], ) { my @array = @{ $_ }; dies_ok { my $hashref = $ME->fetch_memberships( @array ) } $arra +y[1]; } }; }; __END__
The way forward always starts with a minimal test.

In reply to Re^2: Test::Exception error on Strawberry Perl 5.14.3 ('Bareword "xception" ...') by 1nickt
in thread Test::Exception error on Strawberry Perl 5.14.3 ('Bareword "xception" ...') by 1nickt

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, 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?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others examining the Monastery: (5)
    As of 2019-07-17 21:14 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      No recent polls found

      Notices?