Show
Ignore:
Timestamp:
12/12/08 11:05:53 (4 years ago)
Author:
bayashi
Message:

little fixed and added tests

Location:
lang/perl/Acme-CryptPB/trunk
Files:
5 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Acme-CryptPB/trunk/Build.PL

    r23218 r26538  
    66    module_name         => 'Acme::CryptPB', 
    77    license             => 'perl', 
    8     dist_author         => 'Dai Okabayashi <bayashi@perl.org>', 
     8    dist_author         => 'Dai Okabayashi <bayashi@cpan.org>', 
    99    dist_version_from   => 'lib/Acme/CryptPB.pm', 
    1010    requires => { 
    1111        'Test::More' => 0, 
    1212        'version'    => 0, 
     13                'Carp'       => 0, 
    1314    }, 
    1415    add_to_cleanup      => [ 'Acme-CryptPB-*' ], 
  • lang/perl/Acme-CryptPB/trunk/Changes

    r23564 r26538  
    11Revision history for Acme-CryptPB 
    22 
     31.1.3  Fri Dec 12 11:00:00 2008 
     4       little fixed and added tests 
     5            
    361.1.2  Tue Nov 13 13:13:13 2008 
    47       fixed bug.(escape regexp in CryptPB.pm) 
  • lang/perl/Acme-CryptPB/trunk/META.yml

    r23564 r26538  
    11--- 
    22name: Acme-CryptPB 
    3 version: 1.1.2 
     3version: 1.1.3 
    44author: 
    5   - 'Dai Okabayashi <bayashi@perl.org>' 
     5  - 'Dai Okabayashi <bayashi@cpan.org>' 
    66abstract: For Pocket Bell Generation. 
    77license: perl 
     
    99  license: http://dev.perl.org/licenses/ 
    1010requires: 
     11  Carp: 0 
    1112  Test::More: 0 
    1213  version: 0 
     
    1415  Acme::CryptPB: 
    1516    file: lib/Acme/CryptPB.pm 
    16     version: 1.1.2 
     17    version: 1.1.3 
    1718generated_by: Module::Build version 0.3 
    1819meta-spec: 
  • lang/perl/Acme-CryptPB/trunk/lib/Acme/CryptPB.pm

    r23564 r26538  
    55use utf8; 
    66 
    7 use Carp; 
     7use Carp qw( croak ); 
    88 
    9 use version; our $VERSION = qv('1.1.2'); 
     9use version; our $VERSION = qv('1.1.3'); 
    1010 
    1111my %PUN = ( 
     
    4444{ 
    4545    my $self = shift; 
    46     my $str  = shift || return; 
     46    my $str  = shift; 
    4747 
    4848    return $str if $str !~ /[ァ-ンぁ-んヴ]/; 
    49     croak 'require utf8 flagged string' unless utf8::is_utf8($str); 
    5049 
    5150    # hankaku katakana -> zenkaku katakana 
     
    8180{ 
    8281    my $self = shift; 
    83     my $char = shift || return; 
     82    my $char = shift; 
    8483 
    8584    return $self->{pun}->{$char}; 
     
    148147=head1 AUTHOR 
    149148 
    150 Copyright (c) 2008, Dai Okabayashi C<< <bayashi@perl.org> >> 
     149Copyright (c) 2008, Dai Okabayashi C<< <bayashi@cpan.org> >> 
    151150 
    152151 
  • lang/perl/Acme-CryptPB/trunk/t/01.10310.t

    r23218 r26538  
    22use utf8; 
    33 
    4 use Test::More tests => 12; 
     4use Test::More tests => 18; 
    55 
    66use Acme::CryptPB; 
     
    88my $pb = Acme::CryptPB->new(); 
    99 
    10 is($pb->get_pun('う'), '0',    "get_pun hiragana"); 
     10is($pb->get_pun(''),    undef, "get_pun no string"); 
     11is($pb->get_pun('う'), '0',     "get_pun hiragana"); 
    1112is($pb->get_pun('ウ'),  undef, "get_pun katakana"); 
    1213is($pb->get_pun('漢'),  undef, "get_pun kanji"); 
    1314is($pb->get_pun('*'),   undef, "get_pun kigou"); 
     15 
     16is( 
     17    $pb->pbnize(''), 
     18    '', 
     19    "pbnize no string" 
     20); 
     21 
     22is( 
     23    $pb->pbnize('This is test'), 
     24    'This is test', 
     25    "exclusive of HIRAGANA" 
     26); 
     27 
     28my $str = 'おはよう'; 
     29utf8::encode($str); 
     30is( 
     31    $pb->pbnize($str), 
     32    $str, 
     33    "no flag string" 
     34); 
    1435 
    1536is( 
     
    6384); 
    6485 
     86eval { $pb->set_pun(''); }; 
     87like($@, qr/set by hash ref!/, 'set_pun : not hash ref'); 
    6588 
     89eval { $pb->set_pun('hoge'); }; 
     90like($@, qr/set by hash ref!/, 'set_pun : not hash ref 2'); 
     91