Skip to content

WIP: Fix glob() directory wildcards and MakeMaker test pattern support#430

Merged
fglock merged 9 commits into
masterfrom
fix/glob-directory-wildcards
Apr 3, 2026
Merged

WIP: Fix glob() directory wildcards and MakeMaker test pattern support#430
fglock merged 9 commits into
masterfrom
fix/glob-directory-wildcards

Conversation

@fglock
Copy link
Copy Markdown
Owner

@fglock fglock commented Apr 3, 2026

Summary

  • Fix glob() directory wildcards: glob("t/*/*.t") previously returned nothing because the implementation only expanded wildcards in the filename component (after the last /), treating everything before it as a literal directory path. Added recursive glob expansion that processes each path segment independently, expanding wildcards in directory components.

  • Fix MakeMaker test parameter: The generated Makefile test target hardcoded glob(q{t/*.t}), ignoring the module's test => { TESTS => '...' } parameter from WriteMakefile(). Now extracts and uses the custom TESTS pattern when provided.

These two bugs combined caused jcpan -t Excel::Writer::XLSX to silently report Files=0, Tests=0 despite 1,247 test files existing in subdirectories (t/regression/*.t, t/chart/*.t, etc.).

Test plan

  • make passes (all unit tests)
  • glob("t/*/*.t") returns 1,152 files in Excel::Writer::XLSX build dir (was 0)
  • glob("t/*/*.t t/*/*/*.t") returns 1,247 files (the full set)
  • Simple glob patterns (src/test/resources/unit/*.t) still work
  • jcpan -t Excel::Writer::XLSX actually runs tests (WIP)

Generated with Devin

fglock and others added 9 commits April 3, 2026 18:24
Two bugs caused jcpan -t to silently find 0 tests for modules like
Excel::Writer::XLSX whose tests live in subdirectories (t/*/*.t):

1. ScalarGlobOperator: glob("t/*/*.t") returned nothing because
   extractPathComponents() split on the last "/" and tried to open
   "t/*" as a literal directory. Added recursive glob expansion that
   processes each path segment independently, expanding wildcards in
   directory components by listing and matching directory entries.

2. ExtUtils/MakeMaker.pm: The generated Makefile test target hardcoded
   glob(q{t/*.t}), ignoring the test => { TESTS => '...' }
   parameter from WriteMakefile(). Now extracts and uses the TESTS
   pattern when provided.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…el::Writer::XLSX

- Fix split to evaluate arguments in SCALAR context (both JVM and
  interpreter backends). `split //, reverse $str` now correctly
  reverses the string instead of treating it as a list operation.
- Add \p{} and \P{} Unicode property support inside character classes
  in regex preprocessing (RegexPreprocessorHelper).
- Add Emoticons Unicode block mapping in UnicodeResolver.
- Add Archive::Zip::setErrorHandler stub for compatibility.
- Add Excel::Writer::XLSX module tracking document.

Excel::Writer::XLSX test results: 1110/1247 programs pass,
4977/4982 subtests pass (99.9%).

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The CPAN Archive::Zip (line 12) does `use FileHandle ()`, which makes
the FileHandle class available to downstream modules. PerlOnJava's
custom Java-backed Archive::Zip omitted this, causing 133 test failures
in Excel::Writer::XLSX where Utility.pm calls FileHandle->new() without
an explicit `use FileHandle`.

Excel::Writer::XLSX results: 1243/1247 programs pass (99.7%),
5110/5115 subtests pass. Only 4 minor failures remain ('' vs undef
and Emoticons Unicode quoting).

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
In Perl, when a string has the UTF-8 flag set, \w, \d, \s use Unicode
semantics even for characters in the Latin-1 range (e.g., e-acute
U+00E9 should match \w). Previously, PerlOnJava only used the Unicode
regex pattern for strings containing characters > U+00FF, causing
Latin-1 accented characters like e-acute to fail \w matching.

Fix: use the Unicode-aware compiled pattern whenever the input string
has the UTF-8 flag, not just when it contains chars above U+00FF.

This fixes quote_sheetname.t tests 15-16 in Excel::Writer::XLSX.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…aining work

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
In Perl, `open my $fh, '>', \$scalar` where $scalar is undef keeps
it undef until something is actually written. PerlOnJava was eagerly
setting it to '' on open, which caused Test::More::is() failures
when comparing expected undef with actual ''.

This fixes the last 5 failing subtests in Excel::Writer::XLSX,
bringing it to 1247/1247 programs (5115/5115 subtests) passing.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
All 1247 programs and 5115 subtests now pass.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
…-8 flag

Three fixes for regressions introduced by recent commits:

1. RuntimeIO: open '>' on read-only undef scalars (like \undef) now
   correctly fails. The undef preservation fix skipped the set("")
   call which also served as a read-only check. Now sets undef-to-undef
   to trigger the check without changing the value.

2. CharacterClassMapper: [:punct:] now maps to [\p{P}\p{S}] instead
   of \p{Punct}. Java's UNICODE_CHARACTER_CLASS flag changes \p{Punct}
   to only match Unicode Punctuation category, excluding ASCII symbols
   like +, <, =, >, $. Using \p{P}\p{S} covers both Punctuation and
   Symbol categories, matching Perl's behavior. Net improvement: +24
   tests on re/charset.t.

3. RuntimeHash/RuntimeHashProxyEntry: Track hash key byte/UTF-8 flags.
   In Perl, hash keys preserve their byte/UTF-8 type which affects
   regex \w matching semantics. Added byteKeys Set to RuntimeHash,
   updated keys(), iterator, get(), delete(), and state management
   to preserve key types. Fixes 2 regressions in op/utfhash.t.

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
The previous fix mapped [:punct:] to [\p{P}\p{S}] unconditionally, which
broke re/pat_advanced.t because non-Unicode patterns should only match
ASCII punctuation in the 0x80-0xFF range.

Now [:punct:] maps to \p{Punct} (correct ASCII behavior by default), and
the Unicode variant pattern replaces it with [\p{P}\p{S}] to include
symbols when UNICODE_CHARACTER_CLASS is active.

Results:
- re/pat_advanced.t: 1316/1678 (restored from 1315)
- re/charset.t: 5494/5552 (+8 over previous 5486)

Generated with [Devin](https://cli.devin.ai/docs)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@fglock fglock force-pushed the fix/glob-directory-wildcards branch from c3ec3ed to b7f3d2f Compare April 3, 2026 16:24
@fglock fglock merged commit 3166688 into master Apr 3, 2026
2 checks passed
@fglock fglock deleted the fix/glob-directory-wildcards branch April 3, 2026 16:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant