From: Simon McVittie
Date: Sat, 1 Dec 2018 13:37:38 +0000 (+0000)
Subject: po: Add failing test for Debian bug #911356
X-Git-Tag: 3.20190207~73
X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/commitdiff_plain/8503e57916f203b96ac58755986ba5961275c5f9
po: Add failing test for Debian bug #911356
Signed-off-by: Simon McVittie
---
diff --git a/doc/todo/Re-use_translated_content_instead_of_skipping_if_previously_translated.mdwn b/doc/todo/Re-use_translated_content_instead_of_skipping_if_previously_translated.mdwn
index 57386ad75..749551ccc 100644
--- a/doc/todo/Re-use_translated_content_instead_of_skipping_if_previously_translated.mdwn
+++ b/doc/todo/Re-use_translated_content_instead_of_skipping_if_previously_translated.mdwn
@@ -95,5 +95,13 @@
> I've filed this in Debian GNU/Linux at https://bugs.debian.org/911356 â [[lamby]], Thu, 18 Oct 2018 20:18:58 -0400
-
-
+>> As I said on the Debian bug, I think we badly need test coverage for
+>> this sort of thing, otherwise it *will* regress. The po plugin is
+>> relatively complicated and hooks into lots of places in ikiwiki,
+>> and I don't think any of the active ikiwiki maintainers use it
+>> themselves, which means it can easily break (or have pre-existing
+>> bugs) without anyone realising.
+>>
+>> For now I've added a failing test-case for this particular bug.
+>> I'll try to review this soon and understand the po plugin, the patch,
+>> why the bug exists and why the patch fixes it. --[[smcv]]
diff --git a/t/po.t b/t/po.t
index 0db56edc9..3e9b9b7fd 100755
--- a/t/po.t
+++ b/t/po.t
@@ -3,6 +3,7 @@
use warnings;
use strict;
use File::Temp qw{tempdir};
+use utf8;
BEGIN {
unless (eval { require Locale::Po4a::Chooser }) {
@@ -17,7 +18,7 @@ BEGIN {
}
}
-use Test::More tests => 114;
+use Test::More;
BEGIN { use_ok("IkiWiki"); }
@@ -44,7 +45,7 @@ $config{po_slave_languages} = {
es => 'Castellano',
fr => "Français"
};
-$config{po_translatable_pages}='index or test1 or test2 or translatable';
+$config{po_translatable_pages}='index or test1 or test2 or translatable or debian*';
$config{po_link_to}='negotiated';
IkiWiki::loadplugins();
ok(IkiWiki::loadplugin('meta'), "meta plugin loaded");
@@ -67,8 +68,15 @@ $pagesources{'translatable'}='translatable.mdwn';
$pagesources{'translatable.fr'}='translatable.fr.po';
$pagesources{'translatable.es'}='translatable.es.po';
$pagesources{'nontranslatable'}='nontranslatable.mdwn';
+$pagesources{'debian911356'}='debian911356.mdwn';
+$pagesources{'debian911356.fr'}='debian911356.fr.po';
+$pagesources{'debian911356-inlined'}='debian911356-inlined.mdwn';
+$pagesources{'debian911356-inlined.fr'}='debian911356-inlined.fr.po';
+my $now=time;
foreach my $page (keys %pagesources) {
$IkiWiki::pagecase{lc $page}=$page;
+ $IkiWiki::pagectime{$page}=$now;
+ $IkiWiki::pagemtime{$page}=$now;
}
### populate srcdir
@@ -80,6 +88,42 @@ writefile('test2.mdwn', $config{srcdir}, 'test2 content');
writefile('test3.mdwn', $config{srcdir}, 'test3 content');
writefile('translatable.mdwn', $config{srcdir}, '[[nontranslatable]]');
writefile('nontranslatable.mdwn', $config{srcdir}, '[[/]] [[translatable]]');
+writefile('debian911356.mdwn', $config{srcdir}, <Before\sfirst\sinline
+ \s*
+ English\scontent
+ \s*
+ Between\sinlines
+ \s*
+ English\scontent
+ \s*
+ After\sinlines
+}sx);
+
+like($output{'debian911356.fr'}, qr{
+ Avant\sla\spremière\sinline
+ \s*
+ Contenu\sfrançais
+ \s*
+ Entre\sles\sinlines
+ \s*
+ .* # TODO: This paragraph gets mangled (Debian #911356)
+ \s*
+ Après\sles\sinlines
+}sx);
+
+TODO: {
+local $TODO = "Debian bug #911356";
+like($output{'debian911356.fr'}, qr{
+ Avant\sla\spremière\sinline
+ \s*
+ Contenu\sfrançais
+ \s*
+ Entre\sles\sinlines
+ \s*
+ Contenu\sfrançais
+ \s*
+ Après\sles\sinlines
+}sx);
+};
+
+done_testing;