Bug 39130

Summary: Add unit tests for xgettext.pl
Product: Koha Reporter: Julian Maurice <julian.maurice>
Component: Test SuiteAssignee: Julian Maurice <julian.maurice>
Status: Passed QA --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: jonathan.druart, victor
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 39115    
Bug Blocks:    
Attachments: Bug 39130: Add unit tests for xgettext.pl
Bug 39130: Add unit tests for xgettext.pl
Bug 39130: (QA follow-up): Ignore useful untidy part of sample.tt
Bug 39130: Add unit tests for xgettext.pl
Bug 39130: (QA follow-up): Ignore useful untidy part of sample.tt
Bug 39130: Add unit tests for xgettext.pl
Bug 39130: (QA follow-up): Ignore useful untidy part of sample.tt

Description Julian Maurice 2025-02-13 13:26:31 UTC

    
Comment 1 Julian Maurice 2025-02-13 13:28:38 UTC
Created attachment 178008 [details] [review]
Bug 39130: Add unit tests for xgettext.pl

Test plan:
1. Run `prove t/db_dependent/misc/translator/xgettext.pl.t`
Comment 2 Julian Maurice 2025-02-13 13:40:57 UTC
Created attachment 178009 [details] [review]
Bug 39130: Add unit tests for xgettext.pl

Test plan:
1. Run `prove t/db_dependent/misc/translator/xgettext.pl.t`
Comment 3 Jonathan Druart 2025-02-15 05:12:09 UTC
QA script still failing (only 2. is valid)

1.
 FAIL   t/db_dependent/misc/translator/sample-not-working.tt
   FAIL   valid_template
                parse error - /kohadevbox/koha/t/db_dependent/misc/translator/sample-not-working.tt line 2: unexpected end of input

We could exclude it from the QA script. Or just ignore this time: it does not fail xt/author/valid-templates.t (which does the same test but only process template file from koha-tmpl)

2.  
 FAIL   t/db_dependent/misc/translator/sample.tt
   FAIL   tidiness
                File is not tidy, please run `perl misc/devel/tidy.pl t/db_dependent/misc/translator/sample.tt`

This one is problematic as the tidy version remove the space:
-<span [% IF show_title %] title="but this is (thanks to space before attribute name)"[% END %]></span>
+<span [% IF show_title %]title="but this is (thanks to space before attribute name)"[% END %]></span>

So we should not have such occurrences (unless prettier-ignore is used).


3. We are ignoring tt_valid for now
   FAIL   tt_valid
                lines 42, 44, 45
Comment 4 Julian Maurice 2025-02-17 07:22:52 UTC
(In reply to Jonathan Druart from comment #3) 
> 2.  
>  FAIL   t/db_dependent/misc/translator/sample.tt
>    FAIL   tidiness
>                 File is not tidy, please run `perl misc/devel/tidy.pl
> t/db_dependent/misc/translator/sample.tt`
> 
> This one is problematic as the tidy version remove the space:
> -<span [% IF show_title %] title="but this is (thanks to space before
> attribute name)"[% END %]></span>
> +<span [% IF show_title %]title="but this is (thanks to space before
> attribute name)"[% END %]></span>
> 
> So we should not have such occurrences (unless prettier-ignore is used).
I'd like to keep the space, as a way of documenting xgettext.pl behavior.
Can we make the QA script ignore the .tt files in t/ ?
Comment 5 Katrin Fischer 2025-02-17 10:32:25 UTC
(In reply to Julian Maurice from comment #4)
> (In reply to Jonathan Druart from comment #3) 
> > 2.  
> >  FAIL   t/db_dependent/misc/translator/sample.tt
> >    FAIL   tidiness
> >                 File is not tidy, please run `perl misc/devel/tidy.pl
> > t/db_dependent/misc/translator/sample.tt`
> > 
> > This one is problematic as the tidy version remove the space:
> > -<span [% IF show_title %] title="but this is (thanks to space before
> > attribute name)"[% END %]></span>
> > +<span [% IF show_title %]title="but this is (thanks to space before
> > attribute name)"[% END %]></span>
> > 
> > So we should not have such occurrences (unless prettier-ignore is used).
> I'd like to keep the space, as a way of documenting xgettext.pl behavior.
> Can we make the QA script ignore the .tt files in t/ ?

I believe we can - we already made it ignore other places. Have a look here maybe: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39115
Comment 6 Victor Grousset/tuxayo 2025-02-18 00:56:42 UTC
Created attachment 178153 [details] [review]
Bug 39130: (QA follow-up): Ignore useful untidy part of sample.tt

And fix a minor legit tidy issue above.
Comment 7 Victor Grousset/tuxayo 2025-02-18 00:59:58 UTC
(In reply to Julian Maurice from comment #4)
> I'd like to keep the space, as a way of documenting xgettext.pl behavior.
> Can we make the QA script ignore the .tt files in t/ ?

Is the above follow-up ok?
It silences point 2. of comment 3
Comment 8 Julian Maurice 2025-02-18 06:56:38 UTC
(In reply to Victor Grousset/tuxayo from comment #7)
> Is the above follow-up ok?
> It silences point 2. of comment 3
Perfect! Thanks Victor
Comment 9 Victor Grousset/tuxayo 2025-02-19 20:45:14 UTC
Created attachment 178380 [details] [review]
Bug 39130: Add unit tests for xgettext.pl

Test plan:
1. Run `prove t/db_dependent/misc/translator/xgettext.pl.t`

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 10 Victor Grousset/tuxayo 2025-02-19 20:45:16 UTC
Created attachment 178381 [details] [review]
Bug 39130: (QA follow-up): Ignore useful untidy part of sample.tt

And fix a minor legit tidy issue above.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Comment 11 Victor Grousset/tuxayo 2025-02-19 20:45:31 UTC
It works! :)
Comment 12 Jonathan Druart 2025-03-10 12:32:39 UTC
Created attachment 179110 [details] [review]
Bug 39130: Add unit tests for xgettext.pl

Test plan:
1. Run `prove t/db_dependent/misc/translator/xgettext.pl.t`

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 13 Jonathan Druart 2025-03-10 12:32:42 UTC
Created attachment 179111 [details] [review]
Bug 39130: (QA follow-up): Ignore useful untidy part of sample.tt

And fix a minor legit tidy issue above.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 14 Jonathan Druart 2025-03-10 12:33:07 UTC
@RM: you can ignore the QA failures.