Skip to content

Commit

Permalink
Port uuid test to new integration test style
Browse files Browse the repository at this point in the history
  • Loading branch information
GREsau committed Sep 12, 2024
1 parent c16a901 commit 70485aa
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 12 deletions.
3 changes: 3 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 1 addition & 4 deletions schemars/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ indexmap2 = { version = "2.0", default-features = false, features = ["serde"], p
rust_decimal1 = { version = "1", default-features = false, features = ["serde"], package = "rust_decimal" }
semver1 = { version = "1.0.9", default-features = false, features = ["serde"], package = "semver" }
smallvec1 = { version = "1.0", default-features = false, features = ["serde"], package = "smallvec" }
uuid1 = { version = "1.0", default-features = false, features = ["serde"], package = "uuid" }

[features]
default = ["derive", "std"]
Expand All @@ -80,10 +81,6 @@ _ui_test = []
name = "ui"
required-features = ["_ui_test"]

[[test]]
name = "uuid"
required-features = ["uuid1"]

[[test]]
name = "url"
required-features = ["url2"]
Expand Down
2 changes: 2 additions & 0 deletions schemars/tests/integration/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ mod semver;
#[cfg(feature = "smallvec1")]
mod smallvec;
mod std_types;
#[cfg(feature = "uuid1")]
mod uuid;
mod validator;

mod prelude {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"$schema": "https://json-schema.org/draft/2019-09/schema",
"title": "Uuid",
"type": "string",
"format": "uuid"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://json-schema.org/draft/2019-09/schema",
"title": "Uuid",
"type": "string",
"format": "uuid"
}
12 changes: 12 additions & 0 deletions schemars/tests/integration/uuid.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
use crate::prelude::*;
use schemars::generate::SchemaSettings;
use uuid1::Uuid;

#[test]
fn uuid() {
// Must run with draft 2019-09 due to https://github.com/Stranger6667/jsonschema-rs/issues/456
test!(Uuid, SchemaSettings::draft2019_09())
.assert_snapshot()
.assert_allows_ser_roundtrip([Uuid::nil(), Uuid::max(), Uuid::from_u128(1234567890)])
.assert_matches_de_roundtrip(arbitrary_values());
}
7 changes: 0 additions & 7 deletions schemars/tests/uuid.rs

This file was deleted.

0 comments on commit 70485aa

Please sign in to comment.