diff --git a/typify-impl/src/convert.rs b/typify-impl/src/convert.rs index 6e877d71..b92f0783 100644 --- a/typify-impl/src/convert.rs +++ b/typify-impl/src/convert.rs @@ -2067,8 +2067,7 @@ mod tests { use serde_json::json; use crate::{ - test_util::validate_output, validate_builtin, Error, Name, TypeSpace, TypeSpaceImpl, - TypeSpaceSettings, + test_util::validate_output, Error, Name, TypeSpace, TypeSpaceImpl, TypeSpaceSettings, }; #[track_caller] @@ -2177,13 +2176,6 @@ mod tests { validate_output::(); } - // TODO we can turn this on once we generate proper sets. - #[ignore] - #[test] - fn test_set() { - validate_builtin!(std::collections::BTreeSet); - } - #[test] fn test_low_default() { let schema = SchemaObject { diff --git a/typify-impl/src/lib.rs b/typify-impl/src/lib.rs index 93f91dc3..0f5f490b 100644 --- a/typify-impl/src/lib.rs +++ b/typify-impl/src/lib.rs @@ -1176,7 +1176,7 @@ impl<'a> TypeStruct<'a> { } /// Get all information about each struct property. - pub fn properties_info(&'a self) -> impl Iterator { + pub fn properties_info(&'a self) -> impl Iterator> { self.details .properties .iter() diff --git a/typify-impl/src/test_util.rs b/typify-impl/src/test_util.rs index 2a9938f9..bbc2fd46 100644 --- a/typify-impl/src/test_util.rs +++ b/typify-impl/src/test_util.rs @@ -1,4 +1,4 @@ -// Copyright 2022 Oxide Computer Company +// Copyright 2025 Oxide Computer Company use std::{any::type_name, collections::HashSet}; @@ -12,7 +12,7 @@ use syn::{ FieldsNamed, FieldsUnnamed, File, Type, TypePath, TypeTuple, Variant, }; -use crate::{output::OutputSpace, Name, RefKey, TypeId, TypeSpace}; +use crate::{output::OutputSpace, RefKey, TypeId, TypeSpace}; pub(crate) fn get_type() -> (TypeSpace, TypeId) { let schema = schema_for!(T); @@ -141,40 +141,6 @@ fn decanonicalize_std_types(mut input: DeriveInput) -> DeriveInput { input } -#[macro_export] -macro_rules! validate_builtin { - ($t:ty) => { - $crate::test_util::validate_builtin_impl::<$t>(stringify!($t)) - }; -} - -#[track_caller] -pub(crate) fn validate_builtin_impl(name: &str) { - let schema = schema_for!(T); - let original_schema = schemars::schema::Schema::Object(schema.schema.clone()); - - let mut type_space = TypeSpace::default(); - type_space - .add_ref_types(schema.definitions.clone()) - .unwrap(); - let (ty, _) = type_space - .convert_schema_object(Name::Unknown, &original_schema, &schema.schema) - .unwrap(); - - let output = ty.type_ident(&type_space, &None); - - let actual = syn::parse2::(output.clone()).unwrap(); - let expected = syn::parse_str::(name).unwrap(); - - // Make sure they match. - if let Err(err) = expected.syn_cmp(&actual, false) { - println!("{:#?}", schema); - println!("actual: {}", output); - println!("expected: {}", name); - panic!("{}", err); - } -} - pub(crate) trait SynCompare { fn syn_cmp(&self, other: &Self, ignore_variant_names: bool) -> Result<(), String>; }