summaryrefslogtreecommitdiffstats
path: root/t/comments.t
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2011-10-09 10:42:32 -0500
committerJesse Luehrs <doy@tozt.net>2011-10-09 10:44:27 -0500
commitf7e612ae487ce2cf72af1aecf5eb8b1bb45eaeaf (patch)
tree5d80694fc79aebb0283d17554cb2a65618fbbede /t/comments.t
parent4879437a0f628b3d685a3972695aed5011622ca4 (diff)
downloadlocale-pofilemanager-f7e612ae487ce2cf72af1aecf5eb8b1bb45eaeaf.tar.gz
locale-pofilemanager-f7e612ae487ce2cf72af1aecf5eb8b1bb45eaeaf.zip
remove test numbers0.04
Diffstat (limited to 't/comments.t')
-rw-r--r--t/comments.t38
1 files changed, 38 insertions, 0 deletions
diff --git a/t/comments.t b/t/comments.t
new file mode 100644
index 0000000..cced2a9
--- /dev/null
+++ b/t/comments.t
@@ -0,0 +1,38 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use Test::More;
+use File::Temp;
+use File::Copy;
+use Path::Class;
+
+use Locale::POFileManager;
+
+{
+ my $dir = File::Temp->newdir;
+ my $from_dir = dir('t/data/comments');
+ my $tmpdir = dir($dir->dirname);
+ for my $file ($from_dir->children) {
+ copy($file->stringify, $dir->dirname);
+ }
+
+ my $manager = Locale::POFileManager->new(
+ base_dir => $dir->dirname,
+ canonical_language => 'en',
+ );
+ $manager->add_stubs;
+
+ is($tmpdir->file('en.po')->slurp, $from_dir->file('en.po')->slurp,
+ "canonical file untouched");
+
+ my $expected = $from_dir->file("de.po")->slurp;
+ my $got = $tmpdir->file("de.po")->slurp;
+ my $fixed = substr $got, 0, length($expected), '';
+ is($fixed, $expected, "original part of the file wasn't touched");
+ is(substr($got, 0, 1, ''), "\n", "spacing newline added properly");
+ is_deeply([sort split /\n\n/, $got],
+ [qq{msgid "quuux"}, qq{msgid "quux"}],
+ "added the correct stubs");
+}
+
+done_testing;