| 1 | use craterust-analyzer cargo schemars 1.2.2 crate/::preluderust-analyzer cargo schemars 1.2.2 prelude/::*; |
| 2 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::ffirust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/::{CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#, CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#, OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#, OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#}; |
| 3 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::markerrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/::PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#; |
| 4 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::netrust-analyzer cargo std https://github.com/rust-lang/rust/library/std net/::{IpAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/IpAddr#, Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#, Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#, SocketAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr#, SocketAddrV4rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV4#, SocketAddrV6rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV6#}; |
| 5 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::numrust-analyzer cargo std https://github.com/rust-lang/rust/library/std num/::{NonZeroI64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroI64#, NonZeroU64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU64#}; |
| 6 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::opsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/::{Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#, Rangerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#, RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#}; |
| 7 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/::{Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#, PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#}; |
| 8 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::timerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/::{Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#, SystemTimerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/SystemTime#}; |
| 9 | |
| 10 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 11 | fn optionrust-analyzer cargo schemars 1.2.2 std_types/option().() { |
| 12 | testrust-analyzer cargo schemars 1.2.2 test!!(Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<bool>) |
| 13 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().([Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(true), Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#]) |
| 14 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().()); |
| 15 | } |
| 16 | |
| 17 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 18 | fn resultrust-analyzer cargo schemars 1.2.2 std_types/result().() { |
| 19 | testrust-analyzer cargo schemars 1.2.2 test!!(Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#<bool, Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>) |
| 20 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().([Okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Ok#(true), Errrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/Result#Err#("oh no!".to_ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc str/impl#[str][ToOwned]to_owned().())]) |
| 21 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().()); |
| 22 | } |
| 23 | |
| 24 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 25 | fn nonzerorust-analyzer cargo schemars 1.2.2 std_types/nonzero().() { |
| 26 | testrust-analyzer cargo schemars 1.2.2 test!!(NonZeroI64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroI64#) |
| 27 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().([NonZeroI64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroI64#::MINrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<i64>`]MIN., NonZeroI64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroI64#::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<i64>`]MAX.]) |
| 28 | .assert_rejects_derust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_rejects_de().([Valuerust-analyzer cargo serde_json 1.0.151 value/Value#::fromrust-analyzer cargo serde_json 1.0.151 value/from/impl#[Value][`From<i32>`]from().(0)]) |
| 29 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_values_exceptrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values_except().( |
| 30 | |v| v.as_u64rust-analyzer cargo serde_json 1.0.151 value/impl#[Value]as_u64().().is_some_andrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some_and().(|u| u rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u64][`PartialOrd<Self>`]gt().i64::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[i64]MAX. as u64), |
| 31 | "FIXME schema allows out-of-range positive integers", |
| 32 | )); |
| 33 | |
| 34 | testrust-analyzer cargo schemars 1.2.2 test!!(NonZeroU64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU64#) |
| 35 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().([NonZeroU64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU64#::MINrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<u64>`]MIN., NonZeroU64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/NonZeroU64#::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/nonzero/impl#[`NonZero<u64>`]MAX.]) |
| 36 | .assert_rejects_derust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_rejects_de().([Valuerust-analyzer cargo serde_json 1.0.151 value/Value#::fromrust-analyzer cargo serde_json 1.0.151 value/from/impl#[Value][`From<i32>`]from().(0)]) |
| 37 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().()); |
| 38 | } |
| 39 | |
| 40 | const IPV4_SAMPLESrust-analyzer cargo schemars 1.2.2 std_types/IPV4_SAMPLES.: [Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#; 3] = [ |
| 41 | // Commented-out until https://github.com/Stranger6667/jsonschema-rs/issues/512 is fixed |
| 42 | // Ipv4Addr::UNSPECIFIED, |
| 43 | Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#::LOCALHOSTrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv4Addr]LOCALHOST., |
| 44 | Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#::BROADCASTrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv4Addr]BROADCAST., |
| 45 | Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv4Addr]new().(1, 2, 3, 4), |
| 46 | ]; |
| 47 | const IPV6_SAMPLESrust-analyzer cargo schemars 1.2.2 std_types/IPV6_SAMPLES.: [Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#; 4] = [ |
| 48 | Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#::UNSPECIFIEDrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv6Addr]UNSPECIFIED., |
| 49 | Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#::LOCALHOSTrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv6Addr]LOCALHOST., |
| 50 | Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#::LOCALHOSTrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv4Addr]LOCALHOST..to_ipv6_mappedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv4Addr]to_ipv6_mapped().(), |
| 51 | Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/impl#[Ipv6Addr]new().(1, 2, 3, 4, 5, 6, 7, 8), |
| 52 | ]; |
| 53 | |
| 54 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 55 | fn ip_addrrust-analyzer cargo schemars 1.2.2 std_types/ip_addr().() { |
| 56 | testrust-analyzer cargo schemars 1.2.2 test!!(Ipv4Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv4Addr#) |
| 57 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().(IPV4_SAMPLESrust-analyzer cargo schemars 1.2.2 std_types/IPV4_SAMPLES.) |
| 58 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().()); |
| 59 | |
| 60 | testrust-analyzer cargo schemars 1.2.2 test!!(Ipv6Addrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/Ipv6Addr#) |
| 61 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().(IPV6_SAMPLESrust-analyzer cargo schemars 1.2.2 std_types/IPV6_SAMPLES.) |
| 62 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().()); |
| 63 | |
| 64 | testrust-analyzer cargo schemars 1.2.2 test!!(IpAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/ip_addr/IpAddr#) |
| 65 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().(IPV4_SAMPLESrust-analyzer cargo schemars 1.2.2 std_types/IPV4_SAMPLES..maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`]map().(Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#::intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().)) |
| 66 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().(IPV6_SAMPLESrust-analyzer cargo schemars 1.2.2 std_types/IPV6_SAMPLES..maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`]map().(Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#::intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().)) |
| 67 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_values_exceptrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values_except().( |
| 68 | Valuerust-analyzer cargo serde_json 1.0.151 value/Value#::is_stringrust-analyzer cargo serde_json 1.0.151 value/impl#[Value]is_string()., |
| 69 | "Custom format 'ip', so arbitrary strings technically allowed by schema", |
| 70 | )); |
| 71 | } |
| 72 | |
| 73 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 74 | fn socket_addrrust-analyzer cargo schemars 1.2.2 std_types/socket_addr().() { |
| 75 | let port = 12345; |
| 76 | |
| 77 | testrust-analyzer cargo schemars 1.2.2 test!!(SocketAddrV4rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV4#) |
| 78 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().(IPV4_SAMPLESrust-analyzer cargo schemars 1.2.2 std_types/IPV4_SAMPLES..maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`]map().(|ip| SocketAddrV4rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV4#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/impl#[SocketAddrV4]new().(ip, port))) |
| 79 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_values_exceptrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values_except().( |
| 80 | Valuerust-analyzer cargo serde_json 1.0.151 value/Value#::is_stringrust-analyzer cargo serde_json 1.0.151 value/impl#[Value]is_string()., |
| 81 | "Arbitrary strings allowed by schema", |
| 82 | )); |
| 83 | |
| 84 | testrust-analyzer cargo schemars 1.2.2 test!!(SocketAddrV6rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV6#) |
| 85 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().(IPV6_SAMPLESrust-analyzer cargo schemars 1.2.2 std_types/IPV6_SAMPLES..maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`]map().(|ip| SocketAddrV6rust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddrV6#::newrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/impl#[SocketAddrV6]new().(ip, port, 0, 0))) |
| 86 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_values_exceptrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values_except().( |
| 87 | Valuerust-analyzer cargo serde_json 1.0.151 value/Value#::is_stringrust-analyzer cargo serde_json 1.0.151 value/impl#[Value]is_string()., |
| 88 | "Arbitrary strings allowed by schema", |
| 89 | )); |
| 90 | |
| 91 | testrust-analyzer cargo schemars 1.2.2 test!!(SocketAddrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core net/socket_addr/SocketAddr#) |
| 92 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().(IPV4_SAMPLESrust-analyzer cargo schemars 1.2.2 std_types/IPV4_SAMPLES..maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`]map().(|ip| (ip, port).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 93 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().(IPV6_SAMPLESrust-analyzer cargo schemars 1.2.2 std_types/IPV6_SAMPLES..maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`]map().(|ip| (ip, port).intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().())) |
| 94 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_values_exceptrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values_except().( |
| 95 | Valuerust-analyzer cargo serde_json 1.0.151 value/Value#::is_stringrust-analyzer cargo serde_json 1.0.151 value/impl#[Value]is_string()., |
| 96 | "Arbitrary strings allowed by schema", |
| 97 | )); |
| 98 | } |
| 99 | |
| 100 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 101 | fn timerust-analyzer cargo schemars 1.2.2 std_types/time().() { |
| 102 | testrust-analyzer cargo schemars 1.2.2 test!!(SystemTimerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/SystemTime#) |
| 103 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().([SystemTimerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/SystemTime#::UNIX_EPOCHrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[SystemTime]UNIX_EPOCH., SystemTimerust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/SystemTime#::nowrust-analyzer cargo std https://github.com/rust-lang/rust/library/std time/impl#[SystemTime]now().()]) |
| 104 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().()); |
| 105 | |
| 106 | testrust-analyzer cargo schemars 1.2.2 test!!(Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#) |
| 107 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().([Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#::from_secsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]from_secs().(0), Durationrust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/Duration#::from_secs_f64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core time/impl#[Duration]from_secs_f64().(123.456)]) |
| 108 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().()); |
| 109 | } |
| 110 | |
| 111 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 112 | fn c_stringsrust-analyzer cargo schemars 1.2.2 std_types/c_strings().() { |
| 113 | let strings = [ |
| 114 | CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#::defaultrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/impl#[CString][Default]default().(), |
| 115 | CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/impl#[CString]new().("test").unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 116 | CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/impl#[CString]new().([255]).unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]unwrap().(), |
| 117 | ]; |
| 118 | |
| 119 | testrust-analyzer cargo schemars 1.2.2 test!!(CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#) |
| 120 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().(strings.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().()) |
| 121 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_values_exceptrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values_except().( |
| 122 | |v| v.as_strrust-analyzer cargo serde_json 1.0.151 value/impl#[Value]as_str().().is_some_andrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some_and().(|s| s.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().('\0')), |
| 123 | "CString cannot contain null bytes, but schema does not enforce this", |
| 124 | )); |
| 125 | |
| 126 | testrust-analyzer cargo schemars 1.2.2 test!!(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<CStrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ffi/c_str/CStr#>) |
| 127 | .assert_identicalrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_identical().::<CStringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc ffi/c_str/CString#>() |
| 128 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().(strings.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#::intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().)) |
| 129 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_values_exceptrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values_except().( |
| 130 | |v| v.as_strrust-analyzer cargo serde_json 1.0.151 value/impl#[Value]as_str().().is_some_andrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_some_and().(|s| s.containsrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]contains().('\0')), |
| 131 | "CString cannot contain null bytes, but schema does not enforce this", |
| 132 | )); |
| 133 | } |
| 134 | |
| 135 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 136 | fn os_stringsrust-analyzer cargo schemars 1.2.2 std_types/os_strings().() { |
| 137 | let strings = [OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString]new().(), OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/impl#[OsString][`From<&T>`]from().("test")]; |
| 138 | |
| 139 | testrust-analyzer cargo schemars 1.2.2 test!!(OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#) |
| 140 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().(strings.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().()) |
| 141 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().()); |
| 142 | |
| 143 | testrust-analyzer cargo schemars 1.2.2 test!!(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<OsStrrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsStr#>) |
| 144 | .assert_identicalrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_identical().::<OsStringrust-analyzer cargo std https://github.com/rust-lang/rust/library/std ffi/os_str/OsString#>() |
| 145 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().(strings.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#::intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().)) |
| 146 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().()); |
| 147 | } |
| 148 | |
| 149 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 150 | fn pathsrust-analyzer cargo schemars 1.2.2 std_types/paths().() { |
| 151 | let strings = [PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::newrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf]new().(), PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#::fromrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/impl#[PathBuf][`From<&T>`]from().("test")]; |
| 152 | |
| 153 | testrust-analyzer cargo schemars 1.2.2 test!!(PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#) |
| 154 | .assert_identicalrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_identical().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>() |
| 155 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().(strings.clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/impl#[`[T; N]`][Clone]clone().()) |
| 156 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().()); |
| 157 | |
| 158 | testrust-analyzer cargo schemars 1.2.2 test!!(Boxrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc boxed/Box#<Pathrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/Path#>) |
| 159 | .assert_identicalrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_identical().::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>() |
| 160 | .assert_identicalrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_identical().::<PathBufrust-analyzer cargo std https://github.com/rust-lang/rust/library/std path/PathBuf#>() |
| 161 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().(strings.into_iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core array/iter/impl#[`[T; N]`][IntoIterator]into_iter().().maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#::intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().)) |
| 162 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().()); |
| 163 | } |
| 164 | |
| 165 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 166 | fn boundrust-analyzer cargo schemars 1.2.2 std_types/bound().() { |
| 167 | testrust-analyzer cargo schemars 1.2.2 test!!(Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#<i32>).assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().([ |
| 168 | Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Includedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Included#(123), |
| 169 | Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Excludedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Excluded#(456), |
| 170 | Boundrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#::Unboundedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Bound#Unbounded#, |
| 171 | ]); |
| 172 | } |
| 173 | |
| 174 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 175 | fn rangesrust-analyzer cargo schemars 1.2.2 std_types/ranges().() { |
| 176 | testrust-analyzer cargo schemars 1.2.2 test!!(Rangerust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#<i32>) |
| 177 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().([0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#0, 123..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#456]) |
| 178 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().()); |
| 179 | |
| 180 | testrust-analyzer cargo schemars 1.2.2 test!!(RangeInclusiverust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#<i32>) |
| 181 | .assert_allows_ser_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip().([0..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#0, 123..=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeInclusive#456]) |
| 182 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().()); |
| 183 | } |
| 184 | |
| 185 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 186 | fn phantom_datarust-analyzer cargo schemars 1.2.2 std_types/phantom_data().() { |
| 187 | struct DoesNotImplementJsonSchemarust-analyzer cargo schemars 1.2.2 std_types/DoesNotImplementJsonSchema#; |
| 188 | |
| 189 | testrust-analyzer cargo schemars 1.2.2 test!!(PhantomDatarust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/PhantomData#<DoesNotImplementJsonSchemarust-analyzer cargo schemars 1.2.2 std_types/DoesNotImplementJsonSchema#>) |
| 190 | .assert_allows_ser_roundtrip_defaultrust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_allows_ser_roundtrip_default().() |
| 191 | .assert_matches_de_roundtriprust-analyzer cargo schemars 1.2.2 test_helper/impl#[`TestHelper<T>`]assert_matches_de_roundtrip().(arbitrary_valuesrust-analyzer cargo schemars 1.2.2 test_helper/arbitrary_values().()); |
| 192 | } |