aboutsummaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorintrigeri <intrigeri@boum.org>2008-11-02 18:54:04 +0100
committerintrigeri <intrigeri@boum.org>2008-11-02 18:54:04 +0100
commit7d88fb3ff873e1423ed198895ac5647cea58c8ba (patch)
tree57ba597e5e10ba69cc6eaf7cfac862c4595bb67d /t
parent439ba4490acbeafe6206d8723901e16ddcfc611a (diff)
downloadikiwiki-7d88fb3ff873e1423ed198895ac5647cea58c8ba.tar
ikiwiki-7d88fb3ff873e1423ed198895ac5647cea58c8ba.tar.gz
po plugin: added test cases for index.*
(Translatable index is currently buggy, let's fix this.) Signed-off-by: intrigeri <intrigeri@boum.org>
Diffstat (limited to 't')
-rwxr-xr-xt/po.t16
1 files changed, 14 insertions, 2 deletions
diff --git a/t/po.t b/t/po.t
index 9afe8d88f..232c98c81 100755
--- a/t/po.t
+++ b/t/po.t
@@ -17,7 +17,7 @@ BEGIN {
}
}
-use Test::More tests => 24;
+use Test::More tests => 34;
BEGIN { use_ok("IkiWiki"); }
@@ -36,13 +36,15 @@ $config{po_slave_languages} = {
es => 'Castellano',
fr => "Français"
};
-$config{po_translatable_pages}='test1 or test2';
+$config{po_translatable_pages}='index or test1 or test2';
$config{po_link_to}='negotiated';
IkiWiki::loadplugins();
IkiWiki::checkconfig();
ok(IkiWiki::loadplugin('po'), "po plugin loaded");
### seed %pagesources and %pagecase
+$pagesources{'index'}='index.mdwn';
+$pagesources{'index.fr'}='index.fr.po';
$pagesources{'test1'}='test1.mdwn';
$pagesources{'test1.fr'}='test1.fr.po';
$pagesources{'test2'}='test2.mdwn';
@@ -57,6 +59,14 @@ foreach my $page (keys %pagesources) {
### istranslatable/istranslation
# we run these tests twice because memoization attempts made them
# succeed once every two tries...
+ok(IkiWiki::Plugin::po::istranslatable('index'), "index is translatable");
+ok(IkiWiki::Plugin::po::istranslatable('index'), "index is translatable");
+ok(! IkiWiki::Plugin::po::istranslatable('index.fr'), "index is not translatable");
+ok(! IkiWiki::Plugin::po::istranslatable('index.fr'), "index is not translatable");
+ok(! IkiWiki::Plugin::po::istranslation('index'), "index is not a translation");
+ok(! IkiWiki::Plugin::po::istranslation('index'), "index is not a translation");
+ok(IkiWiki::Plugin::po::istranslation('index.fr'), "index.fr is a translation");
+ok(IkiWiki::Plugin::po::istranslation('index.fr'), "index.fr is a translation");
ok(IkiWiki::Plugin::po::istranslatable('test2'), "test2 is translatable");
ok(IkiWiki::Plugin::po::istranslatable('test2'), "test2 is translatable");
ok(! IkiWiki::Plugin::po::istranslation('test2'), "test2 is not a translation");
@@ -73,6 +83,8 @@ is(targetpage('test1', 'html'), 'test1.en.html', "$msgprefix test1");
is(targetpage('test1.fr', 'html'), 'test1.fr.html', "$msgprefix test1.fr");
$config{usedirs}=1;
$msgprefix="targetpage (usedirs=1)";
+is(targetpage('index', 'html'), 'index.en.html', "$msgprefix index");
+is(targetpage('index.fr', 'html'), 'index.fr.html', "$msgprefix index.fr");
is(targetpage('test1', 'html'), 'test1/index.en.html', "$msgprefix test1");
is(targetpage('test1.fr', 'html'), 'test1/index.fr.html', "$msgprefix test1.fr");
is(targetpage('test3', 'html'), 'test3/index.html', "$msgprefix test3 (non-translatable page)");