-
Notifications
You must be signed in to change notification settings - Fork 27
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
Bug: Returns non-string binaries when called on Emojis #34
Comments
A related issue is that in the tests you check if the conversion is a binary (which it always will be), but don't check if the converted string is actually valid: Lines 81 to 82 in bcc27fa
You should instead use: assert String.valid? Slugger.slugify(string)
assert String.valid? Slugger.slugify_downcase(string) Because then it will fail the tests:
|
You can replace your test with this so it logs the exact string for which it fails in the describe "naughty strings" do
"test/big-list-of-naughty-strings/blns.json"
|> File.read!
|> Poison.decode!
|> Enum.with_index
|> Enum.each(fn {string, index} ->
@index index
@string string
@tag capture_log: true
test "no. #{@index}" do
Logger.debug("Testing: #{@string}")
assert String.valid? Slugger.slugify(@string)
assert String.valid? Slugger.slugify_downcase(@string)
end
end)
end
|
This returns invalid string binaries when the string contains an emoji:
The text was updated successfully, but these errors were encountered: