MCPcopy Create free account
hub / github.com/cel-rust/cel-rust / test_index_missing_map_key

Function test_index_missing_map_key

cel/src/objects.rs:2075–2085  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2073
2074 #[test]
2075 fn test_index_missing_map_key() {
2076 let mut ctx = Context::default();
2077 let mut map = HashMap::new();
2078 map.insert("a".to_string(), Value::Int(1));
2079 ctx.add_variable_from_value("mymap", map);
2080
2081 let p = Program::compile(r#"mymap["missing"]"#).expect("Must compile");
2082 let result = p.execute(&ctx);
2083
2084 assert!(result.is_err(), "Should error on missing map key");
2085 }
2086
2087 mod opaque {
2088 use crate::objects::{Map, Opaque, OpaqueVal, OptionalValue};

Callers

nothing calls this directly

Calls 3

IntClass · 0.85
executeMethod · 0.80

Tested by

no test coverage detected