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

Function opaque_eq

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

Source from the content-addressed store, hash-verified

2154
2155 #[test]
2156 fn opaque_eq() {
2157 let value_1 = Arc::new(MyStruct {
2158 field: String::from("1"),
2159 });
2160 let value_2 = Arc::new(MyStruct {
2161 field: String::from("2"),
2162 });
2163
2164 let mut ctx = Context::default();
2165 ctx.add_variable_from_value("v1", Value::Opaque(value_1.clone()));
2166 ctx.add_variable_from_value("v1b", Value::Opaque(value_1));
2167 ctx.add_variable_from_value("v2", Value::Opaque(value_2));
2168 assert_eq!(
2169 Program::compile("v2 == v1").unwrap().execute(&ctx),
2170 Ok(false.into())
2171 );
2172 assert_eq!(
2173 Program::compile("v1 == v1b").unwrap().execute(&ctx),
2174 Ok(true.into())
2175 );
2176 assert_eq!(
2177 Program::compile("v2 == v2").unwrap().execute(&ctx),
2178 Ok(true.into())
2179 );
2180 }
2181
2182 #[test]
2183 fn test_value_holder_dbg() {

Callers

nothing calls this directly

Calls 3

OpaqueInterface · 0.85
cloneMethod · 0.80

Tested by

no test coverage detected