| 1 |
wakaba |
1.5 |
#!/usr/bin/perl |
| 2 |
wakaba |
1.1 |
use strict; |
| 3 |
wakaba |
1.4 |
use Message::Util::Error; |
| 4 |
wakaba |
1.1 |
|
| 5 |
wakaba |
1.4 |
my $src = q{Some Parsed Text}; |
| 6 |
wakaba |
1.1 |
|
| 7 |
wakaba |
1.4 |
my $err = new Message::Util::Error::TextParser |
| 8 |
|
|
package => 'test_error'; |
| 9 |
|
|
|
| 10 |
|
|
report $err -type => 'ERROR_1', source => \$src; |
| 11 |
|
|
|
| 12 |
|
|
$src =~ /Some/gc; |
| 13 |
|
|
|
| 14 |
|
|
report $err -type => 'ERROR_1', source => \$src; |
| 15 |
|
|
|
| 16 |
|
|
$src =~ /Any/gc; |
| 17 |
|
|
|
| 18 |
|
|
report $err -type => 'ERROR_1', source => \$src; |
| 19 |
|
|
|
| 20 |
|
|
$src =~ /Text/gc; |
| 21 |
wakaba |
1.1 |
|
| 22 |
wakaba |
1.4 |
report $err -type => 'ERROR_1', source => \$src; |
| 23 |
wakaba |
1.1 |
|
| 24 |
wakaba |
1.4 |
BEGIN { |
| 25 |
|
|
package test_error; |
| 26 |
|
|
require Message::Util::Error::TextParser; |
| 27 |
|
|
push our @ISA, 'Message::Util::Error::TextParser::error'; |
| 28 |
wakaba |
1.1 |
|
| 29 |
wakaba |
1.4 |
use Test; |
| 30 |
|
|
my @result = qw/1-1 1-5 1-5 1-17/; |
| 31 |
|
|
my $i = 0; |
| 32 |
|
|
plan tests => scalar @result; |
| 33 |
|
|
|
| 34 |
|
|
sub ___report_error ($$) { |
| 35 |
|
|
Test::ok ($_[1]->text, $result[$i++]); |
| 36 |
|
|
warn $_[1]->stringify if $^W; |
| 37 |
wakaba |
1.1 |
} |
| 38 |
|
|
|
| 39 |
wakaba |
1.4 |
sub ___error_def () {+{ |
| 40 |
|
|
ERROR_1 => { |
| 41 |
wakaba |
1.5 |
-description => q(%err-line;-%err-char;), |
| 42 |
wakaba |
1.4 |
}, |
| 43 |
|
|
}} |
| 44 |
|
|
} |
| 45 |
wakaba |
1.1 |
|
| 46 |
|
|
=head1 LICENSE |
| 47 |
|
|
|
| 48 |
wakaba |
1.5 |
Copyright 2003-2007 Wakaba <w@suika.fam.cx> |
| 49 |
wakaba |
1.1 |
|
| 50 |
|
|
This program is free software; you can redistribute it and/or |
| 51 |
|
|
modify it under the same terms as Perl itself. |
| 52 |
|
|
|
| 53 |
|
|
=cut |
| 54 |
|
|
|
| 55 |
wakaba |
1.5 |
1; # $Date: 2003/12/26 07:09:42 $ |