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

Stdlib `$is-valid-string-ascii" does not account for all characters #389

Closed
Acaccia opened this issue Apr 23, 2024 · 0 comments · Fixed by #390
Closed

Stdlib `$is-valid-string-ascii" does not account for all characters #389

Acaccia opened this issue Apr 23, 2024 · 0 comments · Fixed by #390
Assignees
Labels
bug Something isn't working wasm

Comments

@Acaccia
Copy link
Collaborator

Acaccia commented Apr 23, 2024

The function $stdlib.is-valid-string-ascii does not account for some whitespace characters. This causes a bug in the deserialization of strings.

Here is a test that should work:

#[test]
fn all_valid_ascii() {
    let all_chars = "\t\n\x0c\r !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~";
    let snippet = "(from-consensus-buff? (string-ascii 256) 0x0d00000063090a0c0d202122232425262728292a2b2c2d2e2f303132333435363738393a3b3c3d3e3f404142434445464748494a4b4c4d4e4f505152535455565758595a5b5c5d5e5f606162636465666768696a6b6c6d6e6f707172737475767778797a7b7c7d7e)";
    crosscheck(
        snippet,
        Ok(Some(Value::Sequence(SequenceData::String(ASCII(
            ASCIIData {
                data: all_chars.bytes().collect(),
            },
        ))))),
    )
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working wasm
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

1 participant