/[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 - (show 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 #!/usr/bin/perl
2 use strict;
3 use Message::Util::Error;
4
5 my $src = q{Some Parsed Text};
6
7 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
22 report $err -type => 'ERROR_1', source => \$src;
23
24 BEGIN {
25 package test_error;
26 require Message::Util::Error::TextParser;
27 push our @ISA, 'Message::Util::Error::TextParser::error';
28
29 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 }
38
39 sub ___error_def () {+{
40 ERROR_1 => {
41 -description => q(%err-line;-%err-char;),
42 },
43 }}
44 }
45
46 =head1 LICENSE
47
48 Copyright 2003-2007 Wakaba <w@suika.fam.cx>
49
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 1; # $Date: 2003/12/26 07:09:42 $

admin@suikawiki.org
ViewVC Help
Powered by ViewVC 1.1.24