From 38014f0cad580c9f2468c1b72475b876209fb3e6 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 20 Jul 2010 13:24:25 +0200 Subject: Run checkconfig after loading the po plugin, else state is not populated. The pofiles function relies on @slavelanguages to have been populated by po's checkconfig hook. --- t/po.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/po.t') diff --git a/t/po.t b/t/po.t index b6885a37e..495eef6b2 100755 --- a/t/po.t +++ b/t/po.t @@ -42,8 +42,8 @@ $config{po_slave_languages} = { $config{po_translatable_pages}='index or test1 or test2 or translatable'; $config{po_link_to}='negotiated'; IkiWiki::loadplugins(); -IkiWiki::checkconfig(); ok(IkiWiki::loadplugin('po'), "po plugin loaded"); +IkiWiki::checkconfig(); ### seed %pagesources and %pagecase $pagesources{'index'}='index.mdwn'; -- cgit v1.2.3 From c66fae8b16099fa8b0c3c86d38de0733b561d13f Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 20 Jul 2010 13:39:47 +0200 Subject: Added tests for po::pofiles. --- t/po.t | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 't/po.t') diff --git a/t/po.t b/t/po.t index 495eef6b2..de5ace3a0 100755 --- a/t/po.t +++ b/t/po.t @@ -17,7 +17,7 @@ BEGIN { } } -use Test::More tests => 65; +use Test::More tests => 68; BEGIN { use_ok("IkiWiki"); } @@ -91,6 +91,13 @@ ok(! IkiWiki::Plugin::po::istranslatable('test3'), "test3 is not translatable"); ok(! IkiWiki::Plugin::po::istranslation('test3'), "test3 is not a translation"); } +### pofiles + +my @pofiles = IkiWiki::Plugin::po::pofiles(srcfile("index.mdwn")); +ok( @pofiles, "pofiles is defined"); +ok( @pofiles == 2, "pofiles has correct size"); +is_deeply(\@pofiles, ["$config{srcdir}/index.es.po", "$config{srcdir}/index.fr.po"], "pofiles content is correct"); + ### links require IkiWiki::Render; -- cgit v1.2.3 From d98296d1db02febfa7cc4fbe7f304ca2a9858fef Mon Sep 17 00:00:00 2001 From: intrigeri Date: Tue, 20 Jul 2010 13:40:34 +0200 Subject: po.t: fix expected results As index.{es,fr} don't exist, po::refreshpofiles copies them from the basewiki underlay before running msgmerge. msgmerge marks as obsolete the translation strings that came from the basewiki po files, but the link plugin does not make the difference between obsolete and up-to-date links. $links{'index.fr'} and $links{'index.es'} are therefore expected to contain SandBox and ikiwiki. --- t/po.t | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 't/po.t') diff --git a/t/po.t b/t/po.t index de5ace3a0..a52611935 100755 --- a/t/po.t +++ b/t/po.t @@ -118,8 +118,8 @@ $config{po_link_to}='negotiated'; $msgprefix="links (po_link_to=negotiated)"; refresh_n_scan('index.mdwn', 'translatable.mdwn', 'nontranslatable.mdwn'); is_deeply(\@{$links{'index'}}, ['translatable', 'nontranslatable'], "$msgprefix index"); -is_deeply(\@{$links{'index.es'}}, ['translatable.es', 'nontranslatable'], "$msgprefix index.es"); -is_deeply(\@{$links{'index.fr'}}, ['translatable.fr', 'nontranslatable'], "$msgprefix index.fr"); +is_deeply(\@{$links{'index.es'}}, ['translatable.es', 'nontranslatable', 'SandBox', 'ikiwiki'], "$msgprefix index.es"); +is_deeply(\@{$links{'index.fr'}}, ['translatable.fr', 'nontranslatable', 'SandBox', 'ikiwiki'], "$msgprefix index.fr"); is_deeply(\@{$links{'translatable'}}, ['nontranslatable'], "$msgprefix translatable"); is_deeply(\@{$links{'translatable.es'}}, ['nontranslatable'], "$msgprefix translatable.es"); is_deeply(\@{$links{'translatable.fr'}}, ['nontranslatable'], "$msgprefix translatable.fr"); @@ -129,8 +129,8 @@ $config{po_link_to}='current'; $msgprefix="links (po_link_to=current)"; refresh_n_scan('index.mdwn', 'translatable.mdwn', 'nontranslatable.mdwn'); is_deeply(\@{$links{'index'}}, ['translatable', 'nontranslatable'], "$msgprefix index"); -is_deeply(\@{$links{'index.es'}}, [ map bestlink('index.es', $_), ('translatable.es', 'nontranslatable')], "$msgprefix index.es"); -is_deeply(\@{$links{'index.fr'}}, [ map bestlink('index.fr', $_), ('translatable.fr', 'nontranslatable')], "$msgprefix index.fr"); +is_deeply(\@{$links{'index.es'}}, [ (map bestlink('index.es', $_), ('translatable.es', 'nontranslatable')), 'SandBox', 'ikiwiki'], "$msgprefix index.es"); +is_deeply(\@{$links{'index.fr'}}, [ (map bestlink('index.fr', $_), ('translatable.fr', 'nontranslatable')), 'SandBox', 'ikiwiki'], "$msgprefix index.fr"); is_deeply(\@{$links{'translatable'}}, [bestlink('translatable', 'nontranslatable')], "$msgprefix translatable"); is_deeply(\@{$links{'translatable.es'}}, ['nontranslatable'], "$msgprefix translatable.es"); is_deeply(\@{$links{'translatable.fr'}}, ['nontranslatable'], "$msgprefix translatable.fr"); -- cgit v1.2.3 From 855fad15e50217ea768768ad1a3a68bb9422eae1 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Fri, 23 Jul 2010 14:30:15 -0400 Subject: whitespace --- t/po.t | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 't/po.t') diff --git a/t/po.t b/t/po.t index b6885a37e..0155b5303 100755 --- a/t/po.t +++ b/t/po.t @@ -61,7 +61,7 @@ $pagesources{'translatable.fr'}='translatable.fr.po'; $pagesources{'translatable.es'}='translatable.es.po'; $pagesources{'nontranslatable'}='nontranslatable.mdwn'; foreach my $page (keys %pagesources) { - $IkiWiki::pagecase{lc $page}=$page; + $IkiWiki::pagecase{lc $page}=$page; } ### populate srcdir -- cgit v1.2.3 From 5664401fbcd0694539ec8274d2df11b3e5db1e48 Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Sun, 15 Aug 2010 11:38:39 -0400 Subject: Fix po test suite to not assume ikiwiki's underlay is already installed. Closes: #593047 --- debian/changelog | 2 ++ t/po.t | 11 +++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) (limited to 't/po.t') diff --git a/debian/changelog b/debian/changelog index 834dbd265..7f3ea7290 100644 --- a/debian/changelog +++ b/debian/changelog @@ -5,6 +5,8 @@ ikiwiki (3.20100805) UNRELEASED; urgency=low * flattr: New plugin. (Thanks to jaywalk for the initial implementation at a flattr plugin! This one is less configurable, but simpler.) * smiley: warn instead of error for missing smileys (Giuseppe Bilotta) + * Fix po test suite to not assume ikiwiki's underlay is already installed. + Closes: #593047 -- Joey Hess Mon, 09 Aug 2010 13:18:28 -0400 diff --git a/t/po.t b/t/po.t index 444743cac..1cd18c317 100755 --- a/t/po.t +++ b/t/po.t @@ -31,6 +31,9 @@ my $dir = tempdir("ikiwiki-test-po.XXXXXXXXXX", %config=IkiWiki::defaultconfig(); $config{srcdir} = "$dir/src"; $config{destdir} = "$dir/dst"; +$config{destdir} = "$dir/dst"; +$config{underlaydirbase} = "/dev/null"; +$config{underlaydir} = "/dev/null"; $config{discussion} = 0; $config{po_master_language} = { code => 'en', name => 'English' @@ -118,8 +121,8 @@ $config{po_link_to}='negotiated'; $msgprefix="links (po_link_to=negotiated)"; refresh_n_scan('index.mdwn', 'translatable.mdwn', 'nontranslatable.mdwn'); is_deeply(\@{$links{'index'}}, ['translatable', 'nontranslatable'], "$msgprefix index"); -is_deeply(\@{$links{'index.es'}}, ['translatable.es', 'nontranslatable', 'SandBox', 'ikiwiki'], "$msgprefix index.es"); -is_deeply(\@{$links{'index.fr'}}, ['translatable.fr', 'nontranslatable', 'SandBox', 'ikiwiki'], "$msgprefix index.fr"); +is_deeply(\@{$links{'index.es'}}, ['translatable.es', 'nontranslatable'], "$msgprefix index.es"); +is_deeply(\@{$links{'index.fr'}}, ['translatable.fr', 'nontranslatable'], "$msgprefix index.fr"); is_deeply(\@{$links{'translatable'}}, ['nontranslatable'], "$msgprefix translatable"); is_deeply(\@{$links{'translatable.es'}}, ['nontranslatable'], "$msgprefix translatable.es"); is_deeply(\@{$links{'translatable.fr'}}, ['nontranslatable'], "$msgprefix translatable.fr"); @@ -129,8 +132,8 @@ $config{po_link_to}='current'; $msgprefix="links (po_link_to=current)"; refresh_n_scan('index.mdwn', 'translatable.mdwn', 'nontranslatable.mdwn'); is_deeply(\@{$links{'index'}}, ['translatable', 'nontranslatable'], "$msgprefix index"); -is_deeply(\@{$links{'index.es'}}, [ (map bestlink('index.es', $_), ('translatable.es', 'nontranslatable')), 'SandBox', 'ikiwiki'], "$msgprefix index.es"); -is_deeply(\@{$links{'index.fr'}}, [ (map bestlink('index.fr', $_), ('translatable.fr', 'nontranslatable')), 'SandBox', 'ikiwiki'], "$msgprefix index.fr"); +is_deeply(\@{$links{'index.es'}}, [ (map bestlink('index.es', $_), ('translatable.es', 'nontranslatable'))], "$msgprefix index.es"); +is_deeply(\@{$links{'index.fr'}}, [ (map bestlink('index.fr', $_), ('translatable.fr', 'nontranslatable'))], "$msgprefix index.fr"); is_deeply(\@{$links{'translatable'}}, [bestlink('translatable', 'nontranslatable')], "$msgprefix translatable"); is_deeply(\@{$links{'translatable.es'}}, ['nontranslatable'], "$msgprefix translatable.es"); is_deeply(\@{$links{'translatable.fr'}}, ['nontranslatable'], "$msgprefix translatable.fr"); -- cgit v1.2.3