MCPcopy Index your code
hub / github.com/endbasic/endbasic / test_define_and_get_user_callable

Function test_define_and_get_user_callable

core/src/compiler/syms.rs:736–750  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

734
735 #[test]
736 fn test_define_and_get_user_callable() -> Result<()> {
737 let upcalls = HashMap::default();
738 let mut global = GlobalSymtable::new(upcalls);
739
740 let md = CallableMetadataBuilder::new("MY_FUNC")
741 .with_return_type(ExprType::Integer)
742 .test_build();
743 global.declare_user_callable(&VarRef::new("my_func", None), md)?;
744
745 let found = global.get_callable(&SymbolKey::from("my_func"));
746 assert!(found.is_some());
747 assert_eq!("MY_FUNC", found.unwrap().name());
748
749 Ok(())
750 }
751
752 #[test]
753 fn test_define_user_callable_already_defined_but_is_compatible() -> Result<()> {

Callers

nothing calls this directly

Calls 4

test_buildMethod · 0.80
with_return_typeMethod · 0.80
declare_user_callableMethod · 0.80
get_callableMethod · 0.80

Tested by

no test coverage detected