in uniffi_udl/src/finder.rs [319:359]
fn test_extern_local_types() {
test_a_finding(
r#"
typedef interface Interface;
typedef impl Interface2;
typedef trait Trait;
typedef callback Callback;
typedef dictionary R1;
typedef record R2;
typedef record R3;
typedef enum Enum;
"#,
|types| {
assert!(matches!(
types.get_type_definition("Interface").unwrap(),
Type::Object { name, module_path, imp: ObjectImpl::Struct } if name == "Interface" && module_path.is_empty()));
assert!(matches!(
types.get_type_definition("Interface2").unwrap(),
Type::Object { name, module_path, imp: ObjectImpl::Struct } if name == "Interface2" && module_path.is_empty()));
assert!(matches!(
types.get_type_definition("Trait").unwrap(),
Type::Object { name, module_path, imp: ObjectImpl::Trait } if name == "Trait" && module_path.is_empty()));
assert!(matches!(
types.get_type_definition("Callback").unwrap(),
Type::Object { name, module_path, imp: ObjectImpl::CallbackTrait } if name == "Callback" && module_path.is_empty()));
assert!(matches!(
types.get_type_definition("R1").unwrap(),
Type::Record { name, module_path } if name == "R1" && module_path.is_empty()));
assert!(matches!(
types.get_type_definition("R2").unwrap(),
Type::Record { name, module_path } if name == "R2" && module_path.is_empty()));
assert!(matches!(
types.get_type_definition("R3").unwrap(),
Type::Record { name, module_path } if name == "R3" && module_path.is_empty()));
assert!(matches!(
types.get_type_definition("Enum").unwrap(),
Type::Enum { name, module_path } if name == "Enum" && module_path.is_empty()));
},
);
}