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

Invalid serialization of tuple enum variants #395

Closed
dunnock opened this issue Oct 8, 2024 · 3 comments · Fixed by #396
Closed

Invalid serialization of tuple enum variants #395

dunnock opened this issue Oct 8, 2024 · 3 comments · Fixed by #396
Assignees

Comments

@dunnock
Copy link

dunnock commented Oct 8, 2024

Version

simd-json v0.14.0

Description

When writing tuple enum variants simd_json is missing to close block bracket

Test

When trying to run following test

#[test]
fn write_err_simd_json_tuple() {
    #[derive(Serialize, Clone)]
    enum ErrType {
        Instruction(i64, i64),
    }
    let err = ErrType::Instruction(2, 68800);
    #[derive(Serialize)]
    struct Status {
        err: Option<ErrType>,
    }

    assert_eq!(
        simd_json::to_string(&Status {
            err: Some(err.clone())
        })
        .unwrap(),
        serde_json::to_string(&Status { err: Some(err) }).unwrap(),
    );
}

Error

It results with error:

---- messages::tests::write_err_simd_json_tuple stdout ----
thread 'messages::tests::write_err_simd_json_tuple' panicked at src/messages.rs:134:9:
assertion `left == right` failed
  left: "{\"err\":{\"Instruction\":[2,68800}}"
 right: "{\"err\":{\"Instruction\":[2,68800]}}"
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

@Licenser
Copy link
Member

Licenser commented Oct 8, 2024

Good catch, I'll fix and publish a new version this evening

@Licenser Licenser self-assigned this Oct 8, 2024
@Licenser Licenser linked a pull request Oct 8, 2024 that will close this issue
@Licenser
Copy link
Member

Licenser commented Oct 8, 2024

@dunnock released as 0.14.1, tanks again :)

@dunnock
Copy link
Author

dunnock commented Oct 8, 2024

Awesome, thank you for prompt fix!

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 a pull request may close this issue.

2 participants