forked from miyagawa/xml-atom
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DateTime stringification to propper Atom format
- Loading branch information
Showing
3 changed files
with
34 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
use strict; | ||
use warnings; | ||
use Test::More; | ||
|
||
BEGIN { | ||
unless (eval { require DateTime } and eval { require DateTime::Format::Atom }) { | ||
plan skip_all => 'DateTime is required for tests'; | ||
} | ||
} | ||
|
||
plan tests => 2; | ||
|
||
use XML::Atom::Feed; | ||
|
||
my $f = XML::Atom::Feed->new(); | ||
|
||
my $dt = DateTime->now(); | ||
|
||
$f->updated($dt); | ||
|
||
my $xml = $f->as_xml; | ||
my $dt_string = DateTime::Format::Atom->format_datetime($dt); | ||
|
||
like($xml, qr/$dt_string/, "correct format made"); | ||
unlike($xml, qr|<modified/>|, "no empty modified elements"); |