Skip to content

Commit

Permalink
test: add test on OneOrMany
Browse files Browse the repository at this point in the history
  • Loading branch information
marieaurore123 committed Oct 17, 2024
1 parent c8f6646 commit 40f3c18
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion rig-core/rig-core-derive/src/basic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pub(crate) fn basic_embed_fields(data_struct: &DataStruct) -> impl Iterator<Item
})
}

// Adds bounds to where clause that force all fields tagged with #[embed] to implement the Embeddable trait.
/// Adds bounds to where clause that force all fields tagged with #[embed] to implement the Embeddable trait.
pub(crate) fn add_struct_bounds(generics: &mut syn::Generics, field_type: &syn::Type) {
let where_clause = generics.make_where_clause();

Expand Down
1 change: 0 additions & 1 deletion rig-core/rig-core-derive/src/embeddable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ pub(crate) fn expand_derive_embedding(input: &mut syn::DeriveInput) -> syn::Resu
));
}

// Determine whether the Embeddable::Kind should be SingleEmbedding or ManyEmbedding
quote! {
let mut embed_targets = #basic_targets;
embed_targets.extend(#custom_targets)
Expand Down
7 changes: 7 additions & 0 deletions rig-core/src/vec_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,11 @@ mod test {
}
});
}

#[test]
fn test_one_or_many_error() {
assert!(
OneOrMany::<String>::many(vec![]).is_err()
)
}
}

0 comments on commit 40f3c18

Please sign in to comment.