muesli4 / table-layout

Layout data in grids and pretty tables. Provides a lot of tools to get the cell formatting right (positional alignment, alignment on specific characters and limiting of cell width)..
BSD 3-Clause "New" or "Revised" License
37 stars 11 forks source link

Test failures with WideString #52

Closed muesli4 closed 1 year ago

muesli4 commented 1 year ago

I just noticed this earlier:

Failures:

  test-suite/TestSpec.hs:250:13: 
  1) Test.grid.fixed for WideString
       Falsified (after 677 tests and 22 shrinks):
         left
         CutMark {leftMark = "", rightMark = ""}
         Positive {getPositive = Small {getSmall = 1}}
         NonEmpty {getNonEmpty = [WideString "aa1\8205"]}
         2 /= 1

  To rerun use: --match "/Test/grid/fixed/for WideString/"

  test-suite/TestSpec.hs:253:13: 
  2) Test.grid.expandUntil for WideString
       Falsified (after 677 tests and 22 shrinks):
         left
         CutMark {leftMark = "", rightMark = ""}
         Positive {getPositive = Small {getSmall = 1}}
         NonEmpty {getNonEmpty = [WideString "aa1\8205"]}
         2 /= 1

  To rerun use: --match "/Test/grid/expandUntil/for WideString/"

Randomized with seed 2134399471

Finished in 2.3837 seconds
142 examples, 2 failures
Xitian9 commented 1 year ago

That's a Zero-width-joiner following a digit, with nothing after it. Zero-width joiners do weird things to length, and must be joining two characters together. I think this is sufficiently pathological that the correct solution is to just test for this condition and exclude it.