()
| 94 | |
| 95 | #[test] |
| 96 | fn test_inject_variables() { |
| 97 | let mut vm = Vm::default(); |
| 98 | vm.inject_variables({ |
| 99 | let mut map = HashMap::new(); |
| 100 | map.insert("test".into(), "abc".into()); |
| 101 | map.insert("test2".into(), 123.into()); |
| 102 | map.insert("test3".into(), true.into()); |
| 103 | map |
| 104 | }); |
| 105 | vm.compile("return test;").unwrap(); |
| 106 | let result = vm.interpret().unwrap(); |
| 107 | assert_eq!(result, ReturnValue::String("abc".into())); |
| 108 | vm.compile("return test2;").unwrap(); |
| 109 | let result = vm.interpret().unwrap(); |
| 110 | assert_eq!(result, ReturnValue::Number(123.0)); |
| 111 | vm.compile("return test3;").unwrap(); |
| 112 | let result = vm.interpret().unwrap(); |
| 113 | assert_eq!(result, ReturnValue::Boolean(true)); |
| 114 | } |
| 115 | |
| 116 | #[test] |
| 117 | fn test_inject_instance() { |
nothing calls this directly
no test coverage detected