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

Function test_exec_upcall_flow

core/src/vm/mod.rs:722–737  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

720
721 #[tokio::test]
722 async fn test_exec_upcall_flow() {
723 let data = Rc::from(RefCell::from(vec![]));
724 let mut upcalls_by_name: HashMap<SymbolKey, Rc<dyn Callable>> = HashMap::new();
725 upcalls_by_name.insert(SymbolKey::from("OUT"), OutCommand::new(data.clone()));
726
727 let compiler = Compiler::new(&upcalls_by_name, &[]).unwrap();
728 let image = compiler.compile(&mut b"OUT 30: OUT 20".as_slice()).unwrap();
729
730 let mut vm = Vm::new(upcalls_by_name);
731
732 match vm.exec(&image) {
733 StopReason::Eof => (),
734 _ => panic!("Execution should stop at EOF"),
735 }
736 assert_eq!(["30", "20"], *data.borrow().as_slice());
737 }
738
739 #[tokio::test]
740 async fn test_exec_async_upcall_flow() {

Callers

nothing calls this directly

Calls 4

insertMethod · 0.45
compileMethod · 0.45
as_sliceMethod · 0.45
execMethod · 0.45

Tested by

no test coverage detected