#!/usr/bin/perl use strict; use warnings; use Test::More qw(no_plan); use FindBin; use lib "$FindBin::Bin/../lib"; BEGIN { use_ok "Zen::Koan"; } Create_Koan: { my $k = Zen::Koan->new( title => 'foo', body => 'bar' ); isa_ok $k, 'Zen::Koan'; is $k->title, 'foo'; is $k->body, 'bar'; is $k->as_html, <foo

bar

EOT } Create_by_hashref: { my $k = Zen::Koan->new( { title => 'foo' } ); isa_ok $k, 'Zen::Koan'; is $k->title, 'foo'; } Multi_paragraph_koan: { my $body = "this\nand that\n\nand others.\n"; my $k = Zen::Koan->new( title => 'foo', body => $body, ); isa_ok $k, 'Zen::Koan'; is $k->title, 'foo'; is $k->body, $body; is $k->as_html, <foo

this

and that

and others.

EOT } sub poem_koan { Zen::Koan->new( body => <as_html, <A koan by no other name

Here is my poem:

No more water in the pail!

No more moon in the water!

That is my poem.

EOK } Koan_as_text: { my $k = poem_koan(); is $k->as_text, <new; isa_ok $k, 'Zen::Koan'; is $k->title, 'A koan by no other name'; is $k->body, 'This koan offers little wisdom. It just is.'; } Other_functions: { my $k = Zen::Koan->new; isa_ok $k, 'Zen::Koan'; like $k->underlying_meaning, qr#You are expecting too much#; }