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

Function test_clear_resets_runtime_state

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

Source from the content-addressed store, hash-verified

1101
1102 #[tokio::test]
1103 async fn test_clear_resets_runtime_state() {
1104 let compiler = Compiler::new(&HashMap::default(), &[]).unwrap();
1105 let image = compiler.compile(&mut b"x = 7".as_slice()).unwrap();
1106 let mut vm = Vm::new(HashMap::default());
1107 run_to_end(&mut vm, &image).await;
1108
1109 assert_eq!(
1110 Some(ConstantDatum::Integer(7)),
1111 vm.get_program(&image, &SymbolKey::from("x")).unwrap()
1112 );
1113
1114 vm.clear();
1115
1116 assert_eq!(
1117 Some(ConstantDatum::Integer(0)),
1118 vm.get_program(&image, &SymbolKey::from("x")).unwrap()
1119 );
1120 }
1121
1122 #[tokio::test]
1123 async fn test_clear_preserves_upcall_caches() {

Callers

nothing calls this directly

Calls 4

run_to_endFunction · 0.85
compileMethod · 0.45
as_sliceMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected