MCPcopy Create free account
hub / github.com/aiscriptdev/aiscript / test_directive_with_key_value

Function test_directive_with_key_value

aiscript-directive/src/lib.rs:265–277  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

263
264 #[test]
265 fn test_directive_with_key_value() {
266 let directive = parse_single_directive(r#"@validate(min=1, max=10, name="test")"#).unwrap();
267 assert_eq!(directive.name, "validate");
268 match directive.params {
269 DirectiveParams::KeyValue(params) => {
270 assert_eq!(params.len(), 3);
271 assert_eq!(params.get("min").unwrap(), &json!(1));
272 assert_eq!(params.get("max").unwrap(), &json!(10));
273 assert_eq!(params.get("name").unwrap(), &json!("test"));
274 }
275 _ => panic!("Expected KeyValue parameters"),
276 }
277 }
278
279 #[test]
280 fn test_directive_with_nested_directives() {

Callers

nothing calls this directly

Calls 1

parse_single_directiveFunction · 0.85

Tested by

no test coverage detected