use ingraph_codegen::{index::Dedup, search::SearchModel};
fn parse(input: &syn::DeriveInput) -> syn::Result<SearchModel> {
let (host, arguments) = crate::host::split(input);
super::parse(&host, &arguments)
}
fn accepted(input: proc_macro2::TokenStream) -> SearchModel {
parse(&syn::parse2(input).expect("the declaration parses")).expect("the declaration is a recipe")
}
fn refused(input: proc_macro2::TokenStream) -> String {
parse(&syn::parse2(input).expect("the declaration parses"))
.expect_err("this declaration breaks a rule")
.into_iter()
.map(|error| error.to_string())
.collect::<Vec<_>>()
.join("\n")
}
fn spelled(ty: &syn::Type) -> String {
quote::quote!(#ty).to_string().replace(' ', "")
}
fn path(path: &syn::Path) -> String {
quote::quote!(#path).to_string().replace(' ', "")
}
#[test]
fn a_recipe_declares_its_broadcast_and_its_members_are_its_fields() {
let model = accepted(quote::quote! {
#[ingraph(shared(text(type = "String")), dedup(hash), limit = 20)]
pub struct TravelSearch {
#[ingraph(weight = 1.0, depth = 50, tower(zh(type = "crate::ZhQuery", shared)))]
subs: Subs,
#[ingraph(weight = 2.0, depth = 100,
tower(text(type = "crate::ClipText", shared, floor = "crate::floors::SEM_TEXT")),
tower(image(type = "crate::ClipImage", shared)))]
shots: Shots,
}
});
assert_eq!(model.name, "TravelSearch");
assert_eq!(model.dedup, Dedup::Hash);
assert_eq!(model.limit.expect("the head named one").get(), 20);
assert_eq!(model.seats.len(), 1);
assert_eq!(model.seats[0].name, "text");
assert_eq!(spelled(&model.seats[0].ty), "String");
assert_eq!(model.members.len(), 2);
let subs = &model.members[0];
assert_eq!(subs.field, "subs");
assert_eq!(spelled(&subs.ty), "Subs");
assert_eq!(subs.weight, Some(1.0));
assert_eq!(subs.depth.expect("the member named one").get(), 50);
assert!(subs.floor.is_none(), "no member floor was written");
assert_eq!(subs.arms.len(), 1);
assert_eq!(subs.arms[0].name, "zh");
assert_eq!(spelled(&subs.arms[0].tower), "crate::ZhQuery");
let shots = &model.members[1];
assert_eq!(shots.weight, Some(2.0));
assert_eq!(shots.arms.len(), 2);
assert_eq!(shots.arms[0].name, "text");
assert_eq!(
path(shots.arms[0].floor.as_ref().expect("the arm floored it")),
"crate::floors::SEM_TEXT"
);
assert_eq!(shots.arms[1].name, "image");
assert!(model.bound(), "both members bound a tower");
}
#[test]
fn every_word_is_omissible_and_absence_is_never_a_default() {
let model = accepted(quote::quote! {
pub struct Plain {
subs: Subs,
shots: Shots,
}
});
assert!(model.seats.is_empty());
assert_eq!(
model.dedup,
Dedup::Hash,
"the absent word is the root's own"
);
assert!(
model.limit.is_none(),
"a deferral, never the framework's 20"
);
assert!(!model.bound());
for member in &model.members {
assert!(member.weight.is_none());
assert!(member.depth.is_none());
assert!(member.floor.is_none());
assert!(member.arms.is_empty());
}
}
#[test]
fn a_broadcast_may_carry_several_seats() {
let model = accepted(quote::quote! {
#[ingraph(shared(text(type = "String"), image(type = "Vec<u8>")))]
pub struct Two {
#[ingraph(tower(text(type = "T")), tower(image(type = "I")))]
shots: Shots,
}
});
assert_eq!(model.seats.len(), 2);
assert_eq!(model.seats[0].name, "text");
assert_eq!(model.seats[1].name, "image");
assert_eq!(spelled(&model.seats[1].ty), "Vec<u8>");
}
#[test]
fn one_seat_reaches_the_arm_of_its_name_on_every_member() {
let model = accepted(quote::quote! {
#[ingraph(shared(text(type = "String"), image(type = "Vec<u8>")))]
pub struct Two {
#[ingraph(tower(text(type = "A", shared)))]
subs: Subs,
#[ingraph(tower(text(type = "B", shared)), tower(image(type = "C", shared)))]
shots: Shots,
}
});
let bound = |member: usize, arm: usize| {
model.members[member].arms[arm]
.shared
.as_ref()
.expect("the arm wrote `shared`")
.seat
.to_string()
};
assert_eq!(bound(0, 0), "text");
assert_eq!(bound(1, 0), "text");
assert_eq!(bound(1, 1), "image");
}
#[test]
fn a_lone_seat_feeds_every_arm_that_reads_the_broadcast() {
let model = accepted(quote::quote! {
#[ingraph(shared(text(type = "String")))]
pub struct Travel {
#[ingraph(tower(zh(type = "crate::ZhQuery", shared)))]
subs: Subs,
}
});
let binding = model.members[0].arms[0]
.shared
.as_ref()
.expect("the arm wrote `shared`");
assert_eq!(binding.seat, "text", "the sole seat, not the arm's name");
}
#[test]
fn the_shared_word_chooses_the_crossing() {
use ingraph_codegen::search::SharedBridge;
let model = accepted(quote::quote! {
#[ingraph(shared(text(type = "String")))]
pub struct Four {
#[ingraph(
tower(a(type = "A", shared)),
tower(b(type = "B", shared(try))),
tower(c(type = "C", shared(with = "crate::hooks::widen"))),
tower(d(type = "D", shared(try_with = "crate::hooks::narrow"))))]
shots: Shots,
}
});
let bridge = |arm: usize| {
model.members[0].arms[arm]
.shared
.as_ref()
.expect("the arm wrote `shared`")
.bridge
.clone()
};
assert!(matches!(bridge(0), SharedBridge::Total));
assert!(matches!(bridge(1), SharedBridge::Fallible));
match bridge(2) {
SharedBridge::Hook(hook) => assert_eq!(path(&hook), "crate::hooks::widen"),
other => panic!("`with` names a hook, not {}", other.word()),
}
match bridge(3) {
SharedBridge::FallibleHook(hook) => assert_eq!(path(&hook), "crate::hooks::narrow"),
other => panic!("`try_with` names a hook, not {}", other.word()),
}
}
#[test]
fn an_arm_with_no_shared_word_reads_no_broadcast() {
let model = accepted(quote::quote! {
#[ingraph(shared(text(type = "String")))]
pub struct Own {
#[ingraph(tower(text(type = "T")))]
shots: Shots,
}
});
assert!(model.members[0].arms[0].shared.is_none());
}
#[test]
fn a_floor_is_a_const_path_at_the_member_and_at_the_arm() {
let model = accepted(quote::quote! {
pub struct Floored {
#[ingraph(floor = "crate::floors::MEMBER", tower(text(type = "T", floor = "crate::floors::ARM")))]
shots: Shots,
}
});
assert_eq!(
path(model.members[0].floor.as_ref().expect("written")),
"crate::floors::MEMBER"
);
assert_eq!(
path(model.members[0].arms[0].floor.as_ref().expect("written")),
"crate::floors::ARM"
);
}
#[test]
fn arms_may_be_listed_in_one_block_or_in_several() {
let together = accepted(quote::quote! {
pub struct T { #[ingraph(tower(a(type = "A"), b(type = "B")))] shots: Shots }
});
let apart = accepted(quote::quote! {
pub struct T { #[ingraph(tower(a(type = "A")), tower(b(type = "B")))] shots: Shots }
});
for model in [together, apart] {
let names: Vec<String> = model.members[0]
.arms
.iter()
.map(|arm| arm.name.to_string())
.collect();
assert_eq!(names, ["a", "b"]);
}
}
#[test]
fn the_dedup_word_is_the_frameworks_own_at_this_grain() {
let eq = accepted(quote::quote! {
#[ingraph(dedup(eq))]
pub struct T { shots: Shots }
});
assert_eq!(eq.dedup, Dedup::Eq);
assert!(
refused(quote::quote! {
#[ingraph(dedup(bloom))]
pub struct T { shots: Shots }
})
.contains("is not a dedup mechanism")
);
}
#[test]
fn the_crate_word_names_where_ingraph_lives() {
let model = accepted(quote::quote! {
#[ingraph(crate = "other::ingraph")]
pub struct T { shots: Shots }
});
assert_eq!(path(&model.krate), "other::ingraph");
}
#[test]
fn nothing_is_declared_twice() {
let table = [
(
quote::quote! {
#[ingraph(shared(text(type = "A")), shared(image(type = "B")))]
pub struct T { shots: Shots }
},
"`shared(…)` is declared more than once",
),
(
quote::quote! {
#[ingraph(shared(text(type = "A"), text(type = "B")))]
pub struct T { shots: Shots }
},
"`text` is declared more than once in `shared(…)`",
),
(
quote::quote! {
#[ingraph(shared(text(type = "A", type = "B")))]
pub struct T { shots: Shots }
},
"`type` is declared more than once in `text(…)`",
),
(
quote::quote! {
#[ingraph(dedup(hash), dedup(eq))]
pub struct T { shots: Shots }
},
"`dedup` is declared more than once",
),
(
quote::quote! {
#[ingraph(limit = 10, limit = 20)]
pub struct T { shots: Shots }
},
"`limit` is declared more than once in this recipe's head",
),
(
quote::quote! {
pub struct T { #[ingraph(weight = 1.0, weight = 2.0)] shots: Shots }
},
"`weight` is declared more than once on `shots`",
),
(
quote::quote! {
pub struct T { #[ingraph(depth = 10, depth = 20)] shots: Shots }
},
"`depth` is declared more than once in `shots`",
),
(
quote::quote! {
pub struct T { #[ingraph(floor = "crate::A", floor = "crate::B")] shots: Shots }
},
"`floor` is declared more than once in `shots`",
),
(
quote::quote! {
pub struct T { #[ingraph(tower(a(type = "A", type = "B")))] shots: Shots }
},
"`type` is declared more than once in `a(…)` on `shots`",
),
(
quote::quote! {
#[ingraph(shared(text(type = "S")))]
pub struct T { #[ingraph(tower(a(type = "A", shared, shared(try))))] shots: Shots }
},
"`shared` is declared more than once in `a(…)` on `shots`",
),
];
for (written, sentence) in table {
let refusal = refused(written);
assert!(refusal.contains(sentence), "{sentence}\n got: {refusal}");
}
}
#[test]
fn one_member_may_not_bind_two_arms_of_one_name() {
let refusal = refused(quote::quote! {
pub struct T {
#[ingraph(tower(text(type = "A")), tower(text(type = "B")))]
shots: Shots,
}
});
assert!(
refusal.contains("`text` is bound more than once on `shots`"),
"{refusal}"
);
assert!(
refusal.contains("Two MEMBERS may each carry an arm called `text`"),
"{refusal}"
);
}
#[test]
fn a_word_that_named_nothing_is_refused() {
let table = [
(
quote::quote! {
#[ingraph(shared(text))]
pub struct T { shots: Shots }
},
"`text` names no type",
),
(
quote::quote! {
#[ingraph(shared(text()))]
pub struct T { shots: Shots }
},
"`text` names no type",
),
(
quote::quote! {
pub struct T { #[ingraph(tower(a))] shots: Shots }
},
"`a` names no tower",
),
(
quote::quote! {
pub struct T { #[ingraph(tower(a(floor = "crate::F")))] shots: Shots }
},
"`a` names no tower",
),
];
for (written, sentence) in table {
let refusal = refused(written);
assert!(refusal.contains(sentence), "{sentence}\n got: {refusal}");
}
}
#[test]
fn a_bare_shared_at_the_head_is_told_which_position_it_is_at() {
for written in [
quote::quote! {
#[ingraph(shared)]
pub struct T { shots: Shots }
},
quote::quote! {
#[ingraph(shared())]
pub struct T { shots: Shots }
},
] {
let refusal = refused(written);
assert!(
refusal.contains("`shared` at the RECIPE names the seats"),
"{refusal}"
);
assert!(refusal.contains("The BARE word is an ARM's"), "{refusal}");
}
}
#[test]
fn an_empty_tower_block_is_a_word_that_decided_nothing() {
for written in [
quote::quote! { pub struct T { #[ingraph(tower)] shots: Shots } },
quote::quote! { pub struct T { #[ingraph(tower())] shots: Shots } },
] {
let refusal = refused(written);
assert!(
refusal.contains("`tower` names the arms `shots` binds"),
"{refusal}"
);
}
}
#[test]
fn a_shared_arm_names_a_seat_the_recipe_declares() {
let none = refused(quote::quote! {
pub struct T { #[ingraph(tower(text(type = "A", shared)))] shots: Shots }
});
assert!(
none.contains("`text` reads a broadcast this recipe does not declare"),
"{none}"
);
let several = refused(quote::quote! {
#[ingraph(shared(text(type = "A"), image(type = "B")))]
pub struct T { #[ingraph(tower(zh(type = "Z", shared)))] shots: Shots }
});
assert!(
several.contains("`zh` reads a broadcast seat this recipe does not declare"),
"{several}"
);
assert!(several.contains("`text` or `image`"), "{several}");
}
#[test]
fn a_floor_is_never_a_literal() {
let refusal = refused(quote::quote! {
pub struct T { #[ingraph(floor = 0.7)] shots: Shots }
});
assert!(refusal.contains("`floor` names a CONST"), "{refusal}");
assert!(
refusal.contains("open type this framework never sees"),
"{refusal}"
);
}
#[test]
fn a_per_leg_floor_has_no_recipe_side_home() {
for written in [
quote::quote! {
pub struct T { #[ingraph(floor(dense = "crate::F"))] shots: Shots }
},
quote::quote! {
pub struct T { #[ingraph(tower(a(type = "A", floor(dense = "crate::F"))))] shots: Shots }
},
] {
let refusal = refused(written);
assert!(
refusal.contains("`floor(…)` would name a floor per LEG"),
"{refusal}"
);
assert!(
refusal.contains("A per-leg floor is a REQUEST's"),
"{refusal}"
);
}
}
#[test]
fn a_weight_is_a_plain_decimal() {
for written in [
quote::quote! { pub struct T { #[ingraph(weight = 2)] shots: Shots } },
quote::quote! { pub struct T { #[ingraph(weight = "2.0")] shots: Shots } },
] {
let refusal = refused(written);
assert!(refusal.contains("`weight` is a RATIO"), "{refusal}");
}
}
#[test]
fn a_negative_coefficient_is_the_authors_to_intend() {
let model = accepted(quote::quote! {
pub struct T { #[ingraph(weight = -1.0)] shots: Shots }
});
assert_eq!(model.members[0].weight, Some(-1.0));
}
#[test]
fn a_coefficient_has_a_finite_value() {
let refusal = refused(quote::quote! {
pub struct T { #[ingraph(weight = 1e400)] shots: Shots }
});
assert!(
refusal.contains("is past what a coefficient can be"),
"{refusal}"
);
}
#[test]
fn a_zero_is_not_an_answer_anybody_asked_for() {
assert!(
refused(quote::quote! {
#[ingraph(limit = 0)]
pub struct T { shots: Shots }
})
.contains("`limit = 0` asks for an answer with no rows"),
);
assert!(
refused(quote::quote! {
pub struct T { #[ingraph(depth = 0)] shots: Shots }
})
.contains("`depth = 0` asks for an answer with no rows"),
);
}
#[test]
fn depth_is_a_members_number_and_the_head_is_told_so() {
let refusal = refused(quote::quote! {
#[ingraph(depth = 50)]
pub struct T { shots: Shots }
});
assert!(
refusal.contains("`depth` is a MEMBER's number here"),
"{refusal}"
);
assert!(
refusal.contains("What the head takes is `limit`"),
"{refusal}"
);
}
#[test]
fn an_unknown_word_is_refused_where_it_was_written() {
let table = [
(
quote::quote! {
#[ingraph(fuse(rrf))]
pub struct T { shots: Shots }
},
"unknown entry in `#[ingraph::search(…)]`",
),
(
quote::quote! {
#[ingraph(shared(text(type = "S", rename = "x")))]
pub struct T { shots: Shots }
},
"unknown entry in `text(…)`",
),
(
quote::quote! {
pub struct T { #[ingraph(ask)] shots: Shots }
},
"unknown entry in `#[ingraph(…)]` on a member",
),
(
quote::quote! {
pub struct T { #[ingraph(tower(a(type = "A", chain)))] shots: Shots }
},
"unknown entry in `a(…)` on `shots`",
),
(
quote::quote! {
#[ingraph(shared(text(type = "S")))]
pub struct T { #[ingraph(tower(a(type = "A", shared(maybe))))] shots: Shots }
},
"unknown entry in `shared(…)` in `a(…)` on `shots`",
),
];
for (written, sentence) in table {
let refusal = refused(written);
assert!(refusal.contains(sentence), "{sentence}\n got: {refusal}");
}
}
#[test]
fn a_near_miss_suggests_this_positions_own_word() {
let refusal = refused(quote::quote! {
#[ingraph(limt = 20)]
pub struct T { shots: Shots }
});
assert!(refusal.contains("did you mean `limit`"), "{refusal}");
}
#[test]
fn the_try_word_is_bare() {
let refusal = refused(quote::quote! {
#[ingraph(shared(text(type = "S")))]
pub struct T { #[ingraph(tower(a(type = "A", shared(try = "x"))))] shots: Shots }
});
assert!(refusal.contains("`try` is a bare word here"), "{refusal}");
}
#[test]
fn one_arm_crosses_one_way() {
let refusal = refused(quote::quote! {
#[ingraph(shared(text(type = "S")))]
pub struct T {
#[ingraph(tower(a(type = "A", shared(try, with = "crate::hooks::widen"))))]
shots: Shots,
}
});
assert!(
refusal.contains("`shared(…)` names ONE crossing"),
"{refusal}"
);
}
#[test]
fn a_recipe_is_a_struct_with_named_fields_and_no_parameter() {
let table = [
(
quote::quote! { pub struct Empty {} },
"a recipe lists no member",
),
(
quote::quote! { pub struct Unit; },
"a recipe lists no member",
),
(
quote::quote! { pub struct Positional(Subs, Shots); },
"a recipe must be a struct with NAMED fields",
),
(
quote::quote! { pub enum Choice { Subs, Shots } },
"`#[ingraph::search]` supports structs only",
),
(
quote::quote! { pub struct Generic<T> { shots: T } },
"a search recipe takes no generic parameter",
),
(
quote::quote! { pub struct Bounded where Shots: Sized { shots: Shots } },
"a search recipe takes no generic parameter",
),
];
for (written, sentence) in table {
let refusal = refused(written);
assert!(refusal.contains(sentence), "{sentence}\n got: {refusal}");
}
}
#[test]
fn one_compile_reports_the_whole_declaration() {
let refusal = refused(quote::quote! {
#[ingraph(limit = 0, dedup(bloom))]
pub struct Broken {
#[ingraph(weight = 2, depth = 0)]
shots: Shots,
}
});
for sentence in [
"`limit = 0`",
"is not a dedup mechanism",
"`weight` is a RATIO",
"`depth = 0`",
] {
assert!(refusal.contains(sentence), "{sentence}\n got: {refusal}");
}
}
#[test]
fn the_backend_word_is_carried_as_the_backend_it_names() {
let dressed = accepted(quote::quote! {
#[ingraph(shared(text(type = "String")), graphql(async_graphql))]
pub struct TravelSearch { subs: Subs }
});
assert_eq!(
dressed.graphql,
Some(ingraph_codegen::model::GraphqlKind::AsyncGraphql),
);
assert!(dressed.mounts());
let plain = accepted(quote::quote! {
#[ingraph(shared(text(type = "String")))]
pub struct TravelSearch { subs: Subs }
});
assert!(plain.graphql.is_none(), "no block is *no wire face*");
assert!(!plain.mounts());
assert_eq!(plain.members.len(), 1);
assert_eq!(plain.seats.len(), 1);
}
#[test]
fn a_backend_block_that_names_nothing_is_refused() {
for written in [
quote::quote! {
#[ingraph(shared(text(type = "String")), graphql)]
pub struct TravelSearch { subs: Subs }
},
quote::quote! {
#[ingraph(shared(text(type = "String")), graphql())]
pub struct TravelSearch { subs: Subs }
},
] {
let refusal = refused(written);
assert!(refusal.contains("names no backend"), "{refusal}");
assert!(refusal.contains("async_graphql"), "{refusal}");
}
}
#[test]
fn an_unknown_backend_is_refused_with_the_vocabulary() {
let refusal = refused(quote::quote! {
#[ingraph(shared(text(type = "String")), graphql(juniper))]
pub struct TravelSearch { subs: Subs }
});
assert!(refusal.contains("unknown backend"), "{refusal}");
assert!(refusal.contains("async_graphql"), "{refusal}");
}
#[test]
fn a_second_backend_block_is_refused() {
let refusal = refused(quote::quote! {
#[ingraph(
shared(text(type = "String")),
graphql(async_graphql),
graphql(async_graphql)
)]
pub struct TravelSearch { subs: Subs }
});
assert!(refusal.contains("declared more than once"), "{refusal}");
}
#[test]
fn a_published_member_binds_at_most_one_reading_arm_per_seat() {
let refusal = refused(quote::quote! {
#[ingraph(shared(text(type = "String")), graphql(async_graphql))]
pub struct TravelSearch {
#[ingraph(tower(zh(type = "crate::Zh", shared), en(type = "crate::En", shared)))]
subs: Subs,
}
});
assert!(
refusal.contains("produced by ONE bound tower per seat"),
"{refusal}",
);
assert!(refusal.contains("`zh`"), "{refusal}");
assert!(refusal.contains("`en`"), "{refusal}");
assert!(refusal.contains("`text` broadcast"), "{refusal}");
let modes = accepted(quote::quote! {
#[ingraph(
shared(text(type = "String"), code(type = "crate::Sku")),
graphql(async_graphql)
)]
pub struct TravelSearch {
#[ingraph(tower(text(type = "crate::Zh", shared), code(type = "crate::En", shared)))]
subs: Subs,
}
});
assert_eq!(modes.members[0].arms.len(), 2);
assert!(modes.mounts());
let one = accepted(quote::quote! {
#[ingraph(shared(text(type = "String")), graphql(async_graphql))]
pub struct TravelSearch {
#[ingraph(tower(zh(type = "crate::Zh", shared), en(type = "crate::En")))]
subs: Subs,
}
});
assert_eq!(one.members[0].arms.len(), 2);
let undressed = accepted(quote::quote! {
#[ingraph(shared(text(type = "String")))]
pub struct TravelSearch {
#[ingraph(tower(zh(type = "crate::Zh", shared), en(type = "crate::En", shared)))]
subs: Subs,
}
});
assert_eq!(undressed.members[0].arms.len(), 2);
}
#[test]
fn a_dressed_recipe_needs_at_least_one_broadcast_seat() {
let none = refused(quote::quote! {
#[ingraph(graphql(async_graphql))]
pub struct TravelSearch { subs: Subs }
});
assert!(none.contains("declares no `shared(…)` seat"), "{none}");
let several = accepted(quote::quote! {
#[ingraph(
shared(text(type = "String"), point(type = "Vec<f32>")),
graphql(async_graphql)
)]
pub struct TravelSearch { subs: Subs }
});
assert_eq!(several.seats.len(), 2);
assert!(several.mounts());
let undressed = accepted(quote::quote! {
pub struct TravelSearch { subs: Subs }
});
assert_eq!(undressed.members.len(), 1);
assert!(!undressed.mounts());
}
#[test]
fn a_seat_no_member_reaches_is_refused_by_name() {
let refusal = refused(quote::quote! {
#[ingraph(
shared(text(type = "String"), code(type = "crate::Sku")),
graphql(async_graphql)
)]
pub struct TravelSearch {
#[ingraph(tower(text(type = "crate::Zh", shared)))]
subs: Subs,
#[ingraph(tower(text(type = "crate::Clip", shared)))]
shots: Shots,
}
});
assert!(
refusal.contains("`code` is a seat no member reaches"),
"{refusal}"
);
assert!(refusal.contains("shared(…)"), "{refusal}");
let unbound = accepted(quote::quote! {
#[ingraph(
shared(text(type = "String"), code(type = "crate::Sku")),
graphql(async_graphql)
)]
pub struct TravelSearch {
#[ingraph(tower(text(type = "crate::Zh", shared)))]
subs: Subs,
shots: Shots,
}
});
assert!(unbound.mounts());
let split = accepted(quote::quote! {
#[ingraph(
shared(text(type = "String"), code(type = "crate::Sku")),
graphql(async_graphql)
)]
pub struct TravelSearch {
#[ingraph(tower(text(type = "crate::Zh", shared)))]
subs: Subs,
#[ingraph(tower(code(type = "crate::Codes", shared)))]
shots: Shots,
}
});
assert!(split.mounts());
let undressed = accepted(quote::quote! {
#[ingraph(shared(text(type = "String"), code(type = "crate::Sku")))]
pub struct TravelSearch {
#[ingraph(tower(text(type = "crate::Zh", shared)))]
subs: Subs,
#[ingraph(tower(text(type = "crate::Clip", shared)))]
shots: Shots,
}
});
assert_eq!(undressed.seats.len(), 2);
assert!(!undressed.mounts());
}
#[test]
fn the_head_roster_names_the_backend_word() {
let refusal = refused(quote::quote! {
#[ingraph(graphq(async_graphql))]
pub struct TravelSearch { subs: Subs }
});
assert!(refusal.contains("graphql(<backend>)"), "{refusal}");
assert!(refusal.contains("did you mean"), "{refusal}");
}