develooper Front page | perl.perl5.changes | Postings from February 2021

[Perl/perl5] a45bc8: Start refactoring convert_n_test()

From:
James E Keenan via perl5-changes
Date:
February 28, 2021 14:07
Subject:
[Perl/perl5] a45bc8: Start refactoring convert_n_test()
Message ID:
Perl/perl5/push/refs/heads/blead/4aa0af-dac497@github.com
  Branch: refs/heads/blead
  Home:   https://github.com/Perl/perl5
  Commit: a45bc8b17c340f631ee33abf3d6ffda25d880daa
      https://github.com/Perl/perl5/commit/a45bc8b17c340f631ee33abf3d6ffda25d880daa
  Author: James E Keenan <jkeenan@cpan.org>
  Date:   2021-02-28 (Sun, 28 Feb 2021)

  Changed paths:
    M ext/Pod-Html/t/pod2html-lib.pl

  Log Message:
  -----------
  Start refactoring convert_n_test()

This subroutine is used in Pod-Html's test suite.  Currently, it takes a
list of arguments in which:

        1: Root of name of test file in t/
        2: Test description displayed by harness
        3: List of command-line switches for 'pod2html',
           some of which may override default values

When debugging a function, it is useful to be able to dump the
function's arguments before we call the function, and to be able to do
so confidently that what we see in the dump is what we pass to the
function.

However, switches in the third position may silently override default
switches defined by convert_n_test.  That can make debugging a bit
murky.  Let's start by pulling the default switches into a lookup table.


  Commit: 404bfc71817384c1054af3cd82be3654591db1db
      https://github.com/Perl/perl5/commit/404bfc71817384c1054af3cd82be3654591db1db
  Author: James E Keenan <jkeenan@cpan.org>
  Date:   2021-02-28 (Sun, 28 Feb 2021)

  Changed paths:
    M ext/Pod-Html/t/crossref.t
    M ext/Pod-Html/t/crossref2.t
    M ext/Pod-Html/t/crossref3.t
    M ext/Pod-Html/t/feature.t
    M ext/Pod-Html/t/feature2.t
    M ext/Pod-Html/t/htmldir1.t
    M ext/Pod-Html/t/htmldir2.t
    M ext/Pod-Html/t/htmldir3.t
    M ext/Pod-Html/t/htmldir4.t
    M ext/Pod-Html/t/htmldir5.t
    M ext/Pod-Html/t/htmlview.t
    M ext/Pod-Html/t/pod2html-lib.pl
    M ext/Pod-Html/t/podnoerr.t

  Log Message:
  -----------
  Make 3rd argument to convert_n_test a hash ref

Adapt all tests as needed to revised interface to convert_n_test().

Rationale:  convert_n_test is wrapper around pod2html(), which takes a
list of strings each of which is formatted like a command-line switch
(e.g., '--verbose', 'podpath=.').  A string so passed might override a
default value set within convert_n_test().  To be absolutely unambiguous
about what's being passed to pod2html(), we should make sure that a
value is passed to pod2html() only once for a given switch.

This requires a bit of footwork to account for flag switches, but will
facilitate debugging.  To get to that point, we revise convert_n_test()
to take a hashref as its third argument.


  Commit: 744e1042eef34c1ff373f55564934240122fa72e
      https://github.com/Perl/perl5/commit/744e1042eef34c1ff373f55564934240122fa72e
  Author: James E Keenan <jkeenan@cpan.org>
  Date:   2021-02-28 (Sun, 28 Feb 2021)

  Changed paths:
    M ext/Pod-Html/t/pod2html-lib.pl

  Log Message:
  -----------
  List the switches without the hyphens

For simpler 'map'; per suggestion from rjbs in code review.


  Commit: dac4979cf4bffd6eaac2b0800bf59295818fff81
      https://github.com/Perl/perl5/commit/dac4979cf4bffd6eaac2b0800bf59295818fff81
  Author: James E Keenan <jkeenan@cpan.org>
  Date:   2021-02-28 (Sun, 28 Feb 2021)

  Changed paths:
    M ext/Pod-Html/t/pod2html-lib.pl

  Log Message:
  -----------
  Temporarily uncuddle the 'else's


Compare: https://github.com/Perl/perl5/compare/4aa0af0be37d...dac4979cf4bf



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About