Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Property tests and Char8 un/pack fix #6

Merged
merged 2 commits into from
Mar 4, 2022
Merged

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.

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