test::unit::assertion::regexp(3pm) [debian man page]
Test::Unit::Assertion::Regexp(3pm) User Contributed Perl Documentation Test::Unit::Assertion::Regexp(3pm)NAME
Test::Unit::Assertion::Regexp - Assertion with regex matching
SYNOPSIS
require Test::Unit::Assertion::Regexp;
my $assert_re =
Test::Unit::Assertion::Regexp->new(qr/a_pattern/);
$assert_re->do_assertion('a_string');
This is rather more detail than the average user will need. Test::Unit::Assertion::Regexp objects are generated automagically by
Test::Unit::Assert::assert when it is passed a regular expression as its first parameter.
sub test_foo {
...
$self->assert(qr/some_pattern/, $result);
}
If the assertion fails then the object throws an exception with details of the pattern and the string it failed to match against.
Note that if you need to do a 'string does not match this pattern' type of assertion then you can do:
$self->assert(qr/(?!some_pattern)/, $some_string)
ie. Make use of the negative lookahead assertion.
IMPLEMENTS
Test::Unit::Assertion::Regexp implements the Test::Unit::Assertion interface, which means it can be plugged into the Test::Unit::TestCase
and friends' "assert" method with no ill effects.
DESCRIPTION
The class is used by the framework to provide sensible 'automatic' reports when a match fails. The old:
$self->assert(scalar($foo =~ /pattern/), "$foo didn't match /.../");
seems rather clumsy compared to this. If the regexp assertion fails, then the user is given a sensible error message, with the pattern and
the string that failed to match it...
AUTHOR
Copyright (c) 2001 Piers Cawley <pdcawley@iterative-software.com>.
All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
SEE ALSO
o Test::Unit::TestCase
o Test::Unit::Assertion
perl v5.8.8 2006-09-13 Test::Unit::Assertion::Regexp(3pm)
Check Out this Related Man Page
PPIx::Regexp::Structure::Assertion(3) User Contributed Perl Documentation PPIx::Regexp::Structure::Assertion(3)NAME
PPIx::Regexp::Structure::Assertion - Represent a parenthesized assertion
SYNOPSIS
use PPIx::Regexp::Dumper;
PPIx::Regexp::Dumper->new( 'qr{(?<=foo)bar}smx' )
->print();
INHERITANCE
"PPIx::Regexp::Structure::Assertion" is a PPIx::Regexp::Structure.
"PPIx::Regexp::Structure::Assertion" has no descendants.
DESCRIPTION
This class represents one of the parenthesized assertions, either look ahead or look behind, and either positive or negative.
METHODS
This class provides no public methods beyond those provided by its superclass.
SUPPORT
Support is by the author. Please file bug reports at <http://rt.cpan.org>, or in electronic mail to the author.
AUTHOR
Thomas R. Wyant, III wyant at cpan dot org
COPYRIGHT AND LICENSE
Copyright (C) 2009-2013 by Thomas R. Wyant, III
This program is free software; you can redistribute it and/or modify it under the same terms as Perl 5.10.0. For more details, see the full
text of the licenses in the directory LICENSES.
This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of
merchantability or fitness for a particular purpose.
perl v5.16.3 2014-06-10 PPIx::Regexp::Structure::Assertion(3)
I am awk-ing a line, and only want to get the results of the five chrs. following my field seperator. the line of prose is:
Unit=01982 (PICO RIVERA)
Unit=I1001 (INTERMOUNTAIN AREA)
Unit=E1000 (INTERMOUNTAIN WEST DIVISION)
failing in using an awk of:
awk -F= '/Unit/{print $2 length(5)}'... (3 Replies)
Does anyone knwo how to write the following script
In case I have script name as Test
Test pattern Filename will print the lines which contain the pattern for a given file name
so if I have test "oracle" a.log
I will list all the lines containg oracle in a.log file
Thanks
James (2 Replies)
I get this error when I try to FTP from an HP Alpha Server to a UNIX box.
FATAL: BUILD13$:SSHFC_TRANSFER.C;1:1835 SshFCTransfer (function name unavailable) Assertion failed: tdata
->current_dest_file->attributes->flags & 0x00000004
the sftp /put fails just before it does the actual transfer.... (2 Replies)
I'm probably just not thinking of the correct term to search for :-) But I want to match a pattern that might be 'ABC' or '1ABC' there might be three characters, or there might be four, but if there are four, the first has to be 1 (1 Reply)
Hi,
Test file x.txt below. This file is generated by a program that I unfortunately do not have control on how it gets presented/generated.
create PACKAGE "XXX_INTERFACE_DEFECT_RPT_TEST" is
TYPE refCursor IS REF CURSOR;
Function queryRecords (
p_status varchar2,
...
...
...
)... (4 Replies)