Skip to content

Two small changes to get Test2 to fully work on EBCDIC systems.#1077

Merged
exodist merged 2 commits into
Test-More:masterfrom
khwilliamson:ebcdic
Jun 14, 2026
Merged

Two small changes to get Test2 to fully work on EBCDIC systems.#1077
exodist merged 2 commits into
Test-More:masterfrom
khwilliamson:ebcdic

Conversation

@khwilliamson

Copy link
Copy Markdown
Contributor

No description provided.

Comment thread t/modules/Tools/Compare.t Outdated
@khwilliamson khwilliamson force-pushed the ebcdic branch 2 times, most recently from 87eeb1f to 5ae1a9a Compare June 14, 2026 01:35
I no longer remember why I increased the TERM size.  I suspect that
isn't necessary.

An alternative could be to use "\cA", \cB, \cC, \cD instead of \x01 etc.
These are possibly more mnemonic; I don't understand the test well
enough.
The 65 here is ASCII-centric; it is the ord("A").  Map the whole result
with a character set translation call to get it to work on any character
set.  (The mapping is optimized out on an ASCII-based system, so adds no
overhead there.)
Comment thread lib/Test2/Tools/Mock.pm

for (1 .. 100) {
my $postfix = join '', map { chr(rand(26) + 65) } 1 .. 32;
my $postfix = join '', map { chr(utf8::unicode_to_native(rand(26) + 65))

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to insure the utf8 package is loaded first, is there a minimum perl version this works for?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some testing and it looks like we do not need to load utf8, and that this works back to 5.8. I will merge, then add some logic to skip the call on 5.6, but only cause it is not difficult, and there are still people using modern Test2 on 5.6 (yikes)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it utf8: is always loaded, since 5.8. It's fine to not support EBCDIC before then. I haven't looked at what you may have done about 5.6, but I would just create a sub, say to_native that is defined to return its input for earlier than 5.8, and calls unicode_to_native for later. Hence no conditionals are added except for setup.

@exodist exodist merged commit 4d60d18 into Test-More:master Jun 14, 2026
19 checks passed
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.

2 participants