/[suikacvs]/messaging/manakai/t/util-error-textparser.t
Suika

Contents of /messaging/manakai/t/util-error-textparser.t

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.5 - (hide annotations) (download) (as text)
Sat Jun 16 05:30:37 2007 UTC (17 years, 10 months ago) by wakaba
Branch: MAIN
CVS Tags: manakai-release-0-4-0, HEAD
Changes since 1.4: +4 -3 lines
File MIME type: application/x-troff
++ manakai/t/ChangeLog	16 Jun 2007 05:30:30 -0000
	* util-error.t: Tests for new methods are added.
	(___error_def): Amended for new naming convention.

	* util-error-text-formatter.t (___error_def): Amended
	for new naming convention.

2007-06-16  Wakaba  <wakaba@suika.fam.cx>

++ manakai/lib/Message/Util/ChangeLog	16 Jun 2007 05:29:41 -0000
2007-06-16  Wakaba  <wakaba@suika.fam.cx>

	* Error.pod: New documentation, split from |Error.pm|.

	* Error.pm: Documentations are removed.
	(new): |die| if |-type| option is not specified.
	(text, value, type): Do what |Message::Util::Error::DOMException| does,
	with some modification for compatibility with |Error| and
	new naming convention for error type/subtype definitions.
	(code): New method.
	(subtype, type_def): New methods.

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 $

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24  
Google Analytics is used in this page; Cookies are used. 忍者AdMax is used in this page; Cookies are used. Privacy policy.