use jmbl::{Value, OpOutput, JMBL}; use litl::Val; #[test] fn unsets_make_value_null() { let mut jmbl = JMBL::new_from_root( |view| view.create_map([ ("a", Value::Plain(Val::number(1.0))), ("b", "hello".into()), ]), OpOutput::new_dummy(), ); let jmbl1 = jmbl.readable.clone(); assert_eq!( jmbl1.get_root().if_map().unwrap().get("a"), Value::plain(Val::number(1.0)) ); assert_eq!( jmbl1.get_root().if_map().unwrap().get("b"), Value::str("hello") ); jmbl.change(|root, _| root.if_map_mut().unwrap().delete("b")); let jmbl2 = jmbl.readable.clone(); assert_eq!( jmbl2.get_root().if_map().unwrap().get("b"), Value::plain(Val::null()) ); assert_eq!( jmbl2.get_root().if_map().unwrap().val_to_litl(), Val::object([("a", Val::number(1.0)), ("b", Val::null())]) ); }