[Jifty-commit] jifty branch, master, updated. 3fc4aa4925587c01d6a57b5351a732224bb000a7

Jifty commits jifty-commit at lists.jifty.org
Wed Dec 16 09:17:28 EST 2009


The branch, master has been updated
       via  3fc4aa4925587c01d6a57b5351a732224bb000a7 (commit)
       via  144172e4db5016bfea0baa48b6a0c76f80b142e5 (commit)
       via  bb3a1411e6132e7c946ab14624e4420b3067b732 (commit)
       via  f318e01b480a40e994c9582c29168f4825a60eaf (commit)
       via  2a1bc362bf1378c632dabae4538d11293a6f67f9 (commit)
       via  f0331fcad95de277a6e0f8b23f49324c1aff6650 (commit)
       via  2b8a8b5f266195154f8651468171723643320d38 (commit)
       via  8a687e0bd81d72d81e424c962042f827cd5fa479 (commit)
       via  042f5c7ca714d45842148092986efca994b65ef7 (commit)
       via  9124eda5c83be23625422dcf3d305627c32dfcae (commit)
      from  dd250ec35cb883ef2ea107f294ca998ab3b11138 (commit)

Summary of changes:
 t/TestApp-Notifications/etc/config.yml             |   41 ++++++-------------
 .../lib/TestApp/Notification/Foo.pm                |   18 +++++++++
 t/TestApp-Notifications/t/encoding-2.t             |   20 ++++++++++
 t/TestApp-Notifications/t/encoding.t               |   19 ++++++---
 4 files changed, 64 insertions(+), 34 deletions(-)
 create mode 100644 t/TestApp-Notifications/lib/TestApp/Notification/Foo.pm
 create mode 100644 t/TestApp-Notifications/t/encoding-2.t

- Log -----------------------------------------------------------------
commit 9124eda5c83be23625422dcf3d305627c32dfcae
Author: c9s <cornelius.howl at gmail.com>
Date:   Wed Dec 16 10:28:39 2009 +0800

    add another encoding test

diff --git a/t/TestApp-Notifications/t/encoding-2.t b/t/TestApp-Notifications/t/encoding-2.t
new file mode 100644
index 0000000..20aa54f
--- /dev/null
+++ b/t/TestApp-Notifications/t/encoding-2.t
@@ -0,0 +1,28 @@
+#!/usr/bin/env perl
+use warnings;
+use strict;
+use utf8;
+use Jifty::Test::Dist tests => 2;
+use TestApp::Notifications::Notification;
+
+sub send_and_receive {
+    local $Test::Builder::Level = $Test::Builder::Level + 1;
+    my $body = shift;
+
+    Jifty::Test->setup_mailbox;
+
+    my $notification = TestApp::Notifications::Notification->new;
+    $notification->body($body);
+
+    $notification->send_one_message;
+
+    my @emails = Jifty::Test->messages;
+    use Data::Dumper; warn Dumper( \@emails  );
+    Jifty::Test->teardown_mailbox;
+
+    is(scalar @emails, 1, "Sent one notification email");
+    return $emails[0]->body;
+}
+
+my $body = send_and_receive("中文");
+is($body, "中文");

commit 042f5c7ca714d45842148092986efca994b65ef7
Author: c9s <cornelius.howl at gmail.com>
Date:   Wed Dec 16 12:00:54 2009 +0800

    encoding test from mail content directly

diff --git a/t/TestApp-Notifications/t/encoding-2.t b/t/TestApp-Notifications/t/encoding-2.t
index 20aa54f..331cbba 100644
--- a/t/TestApp-Notifications/t/encoding-2.t
+++ b/t/TestApp-Notifications/t/encoding-2.t
@@ -1,11 +1,12 @@
 #!/usr/bin/env perl
 use warnings;
 use strict;
-use utf8;
-use Jifty::Test::Dist tests => 2;
+use Jifty::Test::Dist tests => 4;
+use Jifty::Test::Email;
 use TestApp::Notifications::Notification;
+use utf8;
 
-sub send_and_receive {
+sub send_mail {
     local $Test::Builder::Level = $Test::Builder::Level + 1;
     my $body = shift;
 
@@ -13,16 +14,32 @@ sub send_and_receive {
 
     my $notification = TestApp::Notifications::Notification->new;
     $notification->body($body);
-
     $notification->send_one_message;
 
-    my @emails = Jifty::Test->messages;
-    use Data::Dumper; warn Dumper( \@emails  );
-    Jifty::Test->teardown_mailbox;
+    ok( $notification->body , 'body');
+
+    # my @emails = Jifty::Test->messages;
+    # Jifty::Test->teardown_mailbox;
 
-    is(scalar @emails, 1, "Sent one notification email");
-    return $emails[0]->body;
+    # is(scalar @emails, 1, "Sent one notification email");
+    # return $emails[0]->body;
+}
+
+send_mail("中文");
+
+sub read_mailbox {
+    my $file = shift;
+    local $/;
+    my $mailbox = $file || Jifty::Test->mailbox;
+    ok( -e $mailbox , 'mailbox file ok - ' . $mailbox );
+    open my $fh, "<",$mailbox;
+    binmode $fh, ":utf8";
+    my $text = <$fh>;
+    ok( $text , 'mail content ok' );
+    close $fh;
+    Jifty::Test->setup_mailbox;
+    return $text;
 }
 
-my $body = send_and_receive("中文");
-is($body, "中文");
+my $mail = read_mailbox;
+like($mail , qr'中文's );

commit 8a687e0bd81d72d81e424c962042f827cd5fa479
Author: c9s <cornelius.howl at gmail.com>
Date:   Wed Dec 16 13:53:33 2009 +0800

    config Mailer: IO

diff --git a/t/TestApp-Notifications/etc/config.yml b/t/TestApp-Notifications/etc/config.yml
index 061dd70..0177479 100644
--- a/t/TestApp-Notifications/etc/config.yml
+++ b/t/TestApp-Notifications/etc/config.yml
@@ -1,8 +1,8 @@
 --- 
 framework: 
   AdminMode: 1
-  ApplicationClass: TestApp::Notifications
-  ApplicationName: TestApp-Notifications
+  ApplicationClass: TestApp
+  ApplicationName: TestApp
   ApplicationUUID: F3F2F2C8-E9BB-11DE-AFD7-6AEE7828A805
   ConfigFileVersion: 4
   Database: 
@@ -19,33 +19,18 @@ framework:
   L10N: 
     PoDir: share/po
   LogLevel: INFO
-  Mailer: Sendmail
-  MailerArgs: []
-
+  Mailer: IO
+  MailerArgs:
+    - %log/mail.log%
   Plugins: 
-    - 
-      AdminUI: {}
-
-    - 
-      CompressedCSSandJS: {}
-
-    - 
-      ErrorTemplates: {}
-
-    - 
-      Halo: {}
-
-    - 
-      LetMe: {}
-
-    - 
-      OnlineDocs: {}
-
-    - 
-      REST: {}
-
-    - 
-      SkeletonApp: {}
+    - AdminUI: {}
+    - CompressedCSSandJS: {}
+    - ErrorTemplates: {}
+    - Halo: {}
+    - LetMe: {}
+    - OnlineDocs: {}
+    - REST: {}
+    - SkeletonApp: {}
 
   PubSub: 
     Backend: Memcached

commit 2b8a8b5f266195154f8651468171723643320d38
Author: c9s <cornelius.howl at gmail.com>
Date:   Wed Dec 16 13:55:21 2009 +0800

    fix encoding test

diff --git a/t/TestApp-Notifications/t/encoding.t b/t/TestApp-Notifications/t/encoding.t
index 262ff1e..efa9862 100644
--- a/t/TestApp-Notifications/t/encoding.t
+++ b/t/TestApp-Notifications/t/encoding.t
@@ -23,11 +23,11 @@ sub send_and_receive {
     return $emails[0]->body;
 }
 
-my $body = send_and_receive("Simple Latin-1");
-is($body, "Simple Latin-1");
+my $body = send_and_receive("Simple Latin-1\n\n");
+is($body, "Simple Latin-1\n");
 
 # XXX: should this be "All L\N{LATIN SMALL LETTER E WITH ACUTE}on's fault"
-$body = send_and_receive("All L\x{c3}\x{a9}on's fault");
+$body = send_and_receive("All L\x{c3}\x{a9}on's fault\n\n");
 
-is($body, "All L\x{c3}\x{a9}on's fault", "proper encoding");
+is($body, "All L\x{c3}\x{a9}on's fault\n", "proper encoding");
 

commit f0331fcad95de277a6e0f8b23f49324c1aff6650
Author: c9s <cornelius.howl at gmail.com>
Date:   Wed Dec 16 13:55:58 2009 +0800

    add Foo Notification

diff --git a/t/TestApp-Notifications/lib/TestApp/Notification/Foo.pm b/t/TestApp-Notifications/lib/TestApp/Notification/Foo.pm
new file mode 100644
index 0000000..d5591ca
--- /dev/null
+++ b/t/TestApp-Notifications/lib/TestApp/Notification/Foo.pm
@@ -0,0 +1,19 @@
+package TestApp::Notification::Foo;
+use warnings;
+use strict;
+use base qw(TestApp::Notification);
+use utf8;
+
+sub setup {
+    my $self = shift;
+    $self->SUPER::setup(@_);
+    warn 'Foo here';
+
+    $self->recipients('foo at email');
+    $self->subject('subject');
+    $self->from('from');
+    $self->body('body');
+}
+
+
+1;

commit 2a1bc362bf1378c632dabae4538d11293a6f67f9
Author: c9s <cornelius.howl at gmail.com>
Date:   Wed Dec 16 13:56:19 2009 +0800

    encoding-2 test fixs

diff --git a/t/TestApp-Notifications/t/encoding-2.t b/t/TestApp-Notifications/t/encoding-2.t
index 331cbba..8f3766b 100644
--- a/t/TestApp-Notifications/t/encoding-2.t
+++ b/t/TestApp-Notifications/t/encoding-2.t
@@ -1,45 +1,20 @@
 #!/usr/bin/env perl
 use warnings;
 use strict;
-use Jifty::Test::Dist tests => 4;
+use Jifty::Test tests => 4;
 use Jifty::Test::Email;
-use TestApp::Notifications::Notification;
-use utf8;
+use Test::Exception;
 
-sub send_mail {
-    local $Test::Builder::Level = $Test::Builder::Level + 1;
-    my $body = shift;
+mail_ok  {
+    my $n = Jifty->app_class( 'Notification' => 'Foo' )->new;
+    $n->body( "Simple Latin-1\n\n" );
+    $n->send_one_message;
+    } { body => qr'Simple Latin-1's };
 
-    Jifty::Test->setup_mailbox;
+mail_ok  {
+    my $n = Jifty->app_class( 'Notification' => 'Foo' )->new;
+    $n->body( "中文\n\n\n" );
+    $n->send_one_message;
+    } { body => qr'中文's };
 
-    my $notification = TestApp::Notifications::Notification->new;
-    $notification->body($body);
-    $notification->send_one_message;
-
-    ok( $notification->body , 'body');
-
-    # my @emails = Jifty::Test->messages;
-    # Jifty::Test->teardown_mailbox;
-
-    # is(scalar @emails, 1, "Sent one notification email");
-    # return $emails[0]->body;
-}
-
-send_mail("中文");
-
-sub read_mailbox {
-    my $file = shift;
-    local $/;
-    my $mailbox = $file || Jifty::Test->mailbox;
-    ok( -e $mailbox , 'mailbox file ok - ' . $mailbox );
-    open my $fh, "<",$mailbox;
-    binmode $fh, ":utf8";
-    my $text = <$fh>;
-    ok( $text , 'mail content ok' );
-    close $fh;
-    Jifty::Test->setup_mailbox;
-    return $text;
-}
-
-my $mail = read_mailbox;
-like($mail , qr'中文's );
+1;

commit f318e01b480a40e994c9582c29168f4825a60eaf
Author: c9s <cornelius.howl at gmail.com>
Date:   Wed Dec 16 15:13:55 2009 +0800

    for TestApp , use Jifty::Test::Dist

diff --git a/t/TestApp-Notifications/t/encoding-2.t b/t/TestApp-Notifications/t/encoding-2.t
index 8f3766b..903dfe2 100644
--- a/t/TestApp-Notifications/t/encoding-2.t
+++ b/t/TestApp-Notifications/t/encoding-2.t
@@ -1,7 +1,7 @@
 #!/usr/bin/env perl
 use warnings;
 use strict;
-use Jifty::Test tests => 4;
+use Jifty::Test::Dist tests => 4;
 use Jifty::Test::Email;
 use Test::Exception;
 

commit bb3a1411e6132e7c946ab14624e4420b3067b732
Author: c9s <cornelius.howl at gmail.com>
Date:   Wed Dec 16 15:17:31 2009 +0800

    remove debug code

diff --git a/t/TestApp-Notifications/lib/TestApp/Notification/Foo.pm b/t/TestApp-Notifications/lib/TestApp/Notification/Foo.pm
index d5591ca..dac297a 100644
--- a/t/TestApp-Notifications/lib/TestApp/Notification/Foo.pm
+++ b/t/TestApp-Notifications/lib/TestApp/Notification/Foo.pm
@@ -7,7 +7,6 @@ use utf8;
 sub setup {
     my $self = shift;
     $self->SUPER::setup(@_);
-    warn 'Foo here';
 
     $self->recipients('foo at email');
     $self->subject('subject');

commit 144172e4db5016bfea0baa48b6a0c76f80b142e5
Author: c9s <cornelius.howl at gmail.com>
Date:   Wed Dec 16 20:46:51 2009 +0800

    use encoding utf8 to upgrade utf8 string

diff --git a/t/TestApp-Notifications/t/encoding.t b/t/TestApp-Notifications/t/encoding.t
index efa9862..16fbdf0 100644
--- a/t/TestApp-Notifications/t/encoding.t
+++ b/t/TestApp-Notifications/t/encoding.t
@@ -4,6 +4,7 @@ use strict;
 
 use Jifty::Test::Dist tests => 4;
 use TestApp::Notifications::Notification;
+use encoding 'utf8';
 
 sub send_and_receive {
     local $Test::Builder::Level = $Test::Builder::Level + 1;
@@ -23,11 +24,19 @@ sub send_and_receive {
     return $emails[0]->body;
 }
 
-my $body = send_and_receive("Simple Latin-1\n\n");
-is($body, "Simple Latin-1\n");
+{
+    my $str = "Simple Latin-1\n\n";  # latin bytes string
+    utf8::encode( $str );  # upgrade $str to utf8 bytes string
+    diag $str;
+    my $body = send_and_receive( $str );
+    is($body, $str );
+}
 
 # XXX: should this be "All L\N{LATIN SMALL LETTER E WITH ACUTE}on's fault"
-$body = send_and_receive("All L\x{c3}\x{a9}on's fault\n\n");
-
-is($body, "All L\x{c3}\x{a9}on's fault\n", "proper encoding");
-
+{
+    my $str = "All L\x{c3}\x{a9}on's fault\n\n";   # latin1 bytes string
+    utf8::encode( $str );  # upgrade to utf8 bytes string
+    diag $str;
+    my $body = send_and_receive( $str );
+    is($body, $str );
+}

commit 3fc4aa4925587c01d6a57b5351a732224bb000a7
Author: Shawn M Moore <sartak at bestpractical.com>
Date:   Wed Dec 16 09:17:12 2009 -0500

    Remove some diags

diff --git a/t/TestApp-Notifications/t/encoding.t b/t/TestApp-Notifications/t/encoding.t
index 16fbdf0..66f3c56 100644
--- a/t/TestApp-Notifications/t/encoding.t
+++ b/t/TestApp-Notifications/t/encoding.t
@@ -27,7 +27,6 @@ sub send_and_receive {
 {
     my $str = "Simple Latin-1\n\n";  # latin bytes string
     utf8::encode( $str );  # upgrade $str to utf8 bytes string
-    diag $str;
     my $body = send_and_receive( $str );
     is($body, $str );
 }
@@ -36,7 +35,6 @@ sub send_and_receive {
 {
     my $str = "All L\x{c3}\x{a9}on's fault\n\n";   # latin1 bytes string
     utf8::encode( $str );  # upgrade to utf8 bytes string
-    diag $str;
     my $body = send_and_receive( $str );
     is($body, $str );
 }

-----------------------------------------------------------------------


More information about the Jifty-commit mailing list