MCPcopy Create free account
hub / github.com/PowerShell/DSC / single_match_block

Function single_match_block

resources/sshdconfig/src/parser.rs:542–558  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

540
541 #[test]
542 fn single_match_block() {
543 let input = r#"
544port 22
545match user bob
546 gssapiauthentication yes
547 allowtcpforwarding yes
548"#;
549 let result: Map<String, Value> = parse_text_to_map(input).unwrap();
550 let match_array = result.get("match").unwrap().as_array().unwrap();
551 assert_eq!(match_array.len(), 1);
552 let match_obj = match_array[0].as_object().unwrap();
553 let criteria = match_obj.get("criteria").unwrap().as_object().unwrap();
554 let user_array = criteria.get("user").unwrap().as_array().unwrap();
555 assert_eq!(user_array[0], Value::String("bob".to_string()));
556 assert_eq!(match_obj.get("gssapiauthentication").unwrap(), &Value::Bool(true));
557 assert_eq!(match_obj.get("allowtcpforwarding").unwrap(), &Value::Bool(true));
558 }
559
560 #[test]
561 fn multiple_match_blocks() {

Callers

nothing calls this directly

Calls 2

parse_text_to_mapFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected