Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
The test script at the bottom, is part of a soon to be released update to IO::Pager, once I can solve this problem. The tests behave as expected when invoked from the command line, but fail when invoked via make test or the equivalent command that invokes:
% perl -Mblib t/9-open.t
ok 1 - PAGER undefined since find_pager()
ok 2 - Could not create pipe
1..2
% perl -MExtUtils::Command::MM -e "test_harness (1, 'blib/lib', 'blib/arch' ) " t/9-open.t #-w gives no insight either
t/9-open.t .. 
not ok 1 - PAGER undefined since find_pager()

#   Failed test 'PAGER undefined since find_pager()'
#   at t/9-open.t line 10.
#                   ''
#     doesn't match '(?-xism:The PAGER environment variable is not defined)'
not ok 2 - Could not create pipe

#   Failed test 'Could not create pipe'
#   at t/9-open.t line 14.
#                   ''
#     doesn't match '(?-xism:Could not pipe to PAGER)'
1..2
# Looks like you failed 2 tests of 2.
Dubious, test returned 2 (wstat 512, 0x200)
Failed 2/2 subtests 

Test Summary Report
-------------------
t/9-open.t (Wstat: 512 Tests: 2 Failed: 2)
  Failed tests:  1-2
  Non-zero exit status: 2
Files=1, Tests=2,  0 wallclock secs ( 0.05 usr  0.01 sys +  0.23 cusr  0.02 csys =  0.31 CPU)
Result: FAIL
Failed 1/1 test programs. 2/2 subtests failed.
The test script
use strict; use warnings; use Test::More; use t::TestUtils; use IO::Pager; undef $ENV{PAGER}; eval{ my $token = new IO::Pager }; like($@, qr/The PAGER environment variable is not defined/, 'PAGER und +efined since find_pager()'); $ENV{PAGER} = '/dev/null'; eval{ my $token = new IO::Pager or die $!}; like($@, qr/Could not pipe to PAGER/, 'Could not create pipe'); done_testing;
If you want the whole environment to debug, you can access the code at https://github.com/fangly/io-pager/

TIA!

UPDATE: To clarify, these tests are purposefully setting up conditions for object instantiation to fail, and verifying that the expected/documented errors occur. Nothing really happens in the intervening code, other than seemingly unrelated checks to see if we are connected to a TTY.

--
In Bob We Trust, All Others Bring Data.


In reply to Otherwise successful test fails under test_harness by belg4mit

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (2)
As of 2024-04-26 04:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found