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

Unicase::new(&str) != Unicase::from(&str), from impl ignores ASCII #76

Open
samadDotDev opened this issue Jan 8, 2025 · 2 comments
Open

Comments

@samadDotDev
Copy link
Contributor

The following test fails since the from implementation doesn't check for ASCII vs Unicode encoding, and always maps to unicode even for ASCII strings.

#[cfg(test)]
mod tests {
    use unicase::UniCase;

    #[test]
    fn unicase_ascii() {
        let unicase = UniCase::new("Hello");
        assert!(unicase.is_ascii());

        let unicase: UniCase<&str> = UniCase::from("Hello");
        assert!(unicase.is_ascii());
    }
}
@seanmonstar
Copy link
Owner

Thanks for the report! Would you like to submit a PR fixing it?

@samadDotDev
Copy link
Contributor Author

Thanks for the report! Would you like to submit a PR fixing it?

Sure thing!

samadDotDev added a commit to samadDotDev/unicase that referenced this issue Jan 8, 2025
This addresses seanmonstar#76
which reports that there is an inconsistency between
`UniCase::new()` and `UniCase::from()`
for ASCII strings where the latter doesn't check for encoding.
seanmonstar pushed a commit that referenced this issue Jan 9, 2025
This addresses #76
which reports that there is an inconsistency between
`UniCase::new()` and `UniCase::from()`
for ASCII strings where the latter doesn't check for encoding.
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

2 participants