Skip to content

Test passes on 5.3.0 but fails on 5.4.0~beta2 #235

@edwintorok

Description

@edwintorok

It reliably fails like this on 5.4.0~beta2

 TEST  test_man
       Invoke with --test-help[=FMT] to test --help[=FMT] interactively
       Test plain text manpage
       File "/var/home/edwin/git/cmdliner/test/test_man.ml", line 112, characters 35-3477:
--- expected
+++ found
@@ -1,6 +1,5 @@
 NAME
-       man_test - UTF-8 test: 🐫 íöüóőúűéáăîâșț
-       ÍÜÓŐÚŰÉÁĂÎÂȘȚ 雙峰駱駝
+       man_test - UTF-8 test: 🐫 íöüóőúűéáăîâșț ÍÜÓŐÚŰÉÁĂÎÂȘȚ 雙峰駱駝
 
 SYNOPSIS
        man_test [OPTION]…

       Test groff manpage
       1 snapshot is incorrect. Run with --correct to correct it.
 FAIL  1/2 test failed in 1.9ms

And it reliably passes on 5.3.0.

Tried with 2 different terminal emulators (ghostty and konsole).
Tried with 2 different shells (bash and zsh).
The behaviour is the same in all 4: works with 5.3.0, fails with 5.4.0~beta2.

A quick peek at the changes in 5.4.0 shows that this might be related, especially given the Unicode char there (do they compute different widths?):

+- #13570, #13794: Format, add an out_width function to Format device for
+   approximating unicode width.
+  (Florian Angeletti, review by Nicolás Ojeda Bär, Daniel Bünzli,
+   and Gabriel Scherer)

This is going to be a bit annoying to fix, perhaps based on the compiler version the test should expect 2 different outcomes?
A better fix might be to override out_width on OCaml 5.4 and set it to be compatible with OCaml <5.4 behaviour, although that'd need conditional compilation based on the OCaml version then.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions