Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Test::Exception error on Strawberry Perl 5.14.3 ('Bareword "xception" ...')

by stevieb (Abbot)
on Jul 28, 2015 at 16:55 UTC ( #1136635=note: print w/replies, xml ) Need Help??


in reply to Test::Exception error on Strawberry Perl 5.14.3 ('Bareword "xception" ...')

Can you post the test file (or at least to just after line 14), or otherwise let us know which module you're speaking of?

I need to troubleshoot some failing tests for Strawberry Perl as well today...

  • Comment on Re: Test::Exception error on Strawberry Perl 5.14.3 ('Bareword "xception" ...')

Replies are listed 'Best First'.
Re^2: Test::Exception error on Strawberry Perl 5.14.3 ('Bareword "xception" ...')
by 1nickt (Abbot) on Jul 28, 2015 at 17:34 UTC

    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.
      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.

      In those test files, the one that fails is the only one that contains:
      use open ':std', ':encoding(utf8)';
      Could that be connected to the error ? (Comment it out and see whether the same error arises.)
      Does that line *have* to be situated before the loading of Test::Exception ?

      Cheers,
      Rob

        Thanks syphilis, it's worth a try. I'll make a new version and upload it tonight.


        The way forward always starts with a minimal test.
      Did you try to reproduce the problem without all that extra CMS stuff?

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1136635]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (2)
As of 2019-07-20 09:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?