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

Function subsystem_keyword

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

Source from the content-addressed store, hash-verified

403
404 #[test]
405 fn subsystem_keyword() {
406 let input = r#"
407 subsystem sftp /usr/bin/sftp
408 subsystem pwsh c:/progra~1/powershell/7/pwsh.exe -sshs -NoLogo -NoProfile
409 "#.trim_start();
410 let result: Map<String, Value> = parse_text_to_map(input).unwrap();
411 let subsystems = result.get("subsystem").unwrap().as_array().unwrap();
412 assert_eq!(subsystems.len(), 2);
413
414 // Check first subsystem
415 let sftp = subsystems[0].as_object().unwrap();
416 assert_eq!(sftp.get("name").unwrap(), &Value::String("sftp".to_string()));
417 assert_eq!(sftp.get("value").unwrap(), &Value::String("/usr/bin/sftp".to_string()));
418
419 // Check second subsystem with multiple arguments
420 let pwsh = subsystems[1].as_object().unwrap();
421 assert_eq!(pwsh.get("name").unwrap(), &Value::String("pwsh".to_string()));
422 assert_eq!(pwsh.get("value").unwrap(), &Value::String("c:/progra~1/powershell/7/pwsh.exe -sshs -NoLogo -NoProfile".to_string()));
423 }
424
425 #[test]
426 fn subsystem_single_entry() {

Callers

nothing calls this directly

Calls 2

parse_text_to_mapFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected