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

char_from_list panic on multi-codepoint characters #8

Closed
mooreryan opened this issue Jan 25, 2025 · 1 comment
Closed

char_from_list panic on multi-codepoint characters #8

mooreryan opened this issue Jan 25, 2025 · 1 comment

Comments

@mooreryan
Copy link
Owner

char_from_list will panic if any of the "characters" are made up of more than one codepoint. E.g., this test will panic

pub fn char_from_list__multi_codepoint_chars__test() {
  let e_accent = "é"
  let assert True = e_accent == "\u{65}\u{301}"

  use string <- qcheck.given(qcheck.char_from_list(e_accent, []))
  string == e_accent
}

Error:

  1) qcheck/gen_char_test.char_from_list__multi_codepoint_chars__test
     #{function => <<"unsafe_char_to_int">>,line => 2376,
       message => <<"Pattern match failed, no pattern matched the value.">>,
       module => <<"qcheck">>,
       value => [101,769],
       gleam_error => let_assert}
     location: qcheck.unsafe_char_to_int:2376
     stacktrace:
       qcheck.unsafe_char_to_int
       qcheck.char_from_list
       qcheck/gen_char_test.char_from_list__multi_codepoint_chars__test

Will have to consider how to handle this in a reasonable way.

@mooreryan
Copy link
Owner Author

This has been fixed in the v1 preview branch: e08511f

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

No branches or pull requests

1 participant