Skip to content

Property tests and Char8 un/pack fix#6

Merged
MichaelXavier merged 2 commits intoSoostone:masterfrom
dino-:tests
Mar 4, 2022
Merged

Property tests and Char8 un/pack fix#6
MichaelXavier merged 2 commits intoSoostone:masterfrom
dino-:tests

Conversation

@dino-
Copy link
Contributor

@dino- dino- commented Mar 1, 2022

This adds a suite of property tests that expose the Char8 breakage that can occur when using Data.ByteString.Char8 pack and unpack. The PR also includes a fix for this using Text encode and decode.

dino- added 2 commits March 1, 2022 11:40
Note: These tests are failing because the pack and unpack functions in
Data.ByteString.Char8 are for ASCII *only*. QuickCheck is easily finding
Unicode strings that don't convert correctly using this method. This
will be addressed in another commit.

Also added dist-* to .gitignore for more modern cabal build artifacts.
If anything but ASCII or ISO-8859-1 is being worked with, it's safer to
convert between String and ByteString through Text's encodeUtf8 and
decodeUtf8 functions. The pack functions in Char8 are for ASCII only.
This may bite people more than they think, say with UTF-8, which is VERY
common.

This fixes the broken property tests added in an earlier commit.
@MichaelXavier
Copy link
Contributor

This looks great. Thank you for this! I'll get a release out soon.

@MichaelXavier MichaelXavier merged commit 9d1692a into Soostone:master Mar 4, 2022
@MichaelXavier
Copy link
Contributor

Released as string-conv-0.2.0

@dino- dino- deleted the tests branch March 17, 2022 15:02
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