MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / test_json_status_escapes_paths

Function test_json_status_escapes_paths

atomic-cli/src/commands/status.rs:1056–1071  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1054
1055 #[test]
1056 fn test_json_status_escapes_paths() {
1057 let mut status = RepositoryStatus::new("dev".to_string(), None);
1058 status.add_entry(FileStatusEntry::new(
1059 PathBuf::from("line\nbreak.txt"),
1060 FileStatus::Untracked,
1061 ));
1062
1063 let output = JsonStatus::new(&status, std::path::Path::new("/workspace"));
1064 let json = serde_json::to_string(&output).unwrap();
1065
1066 assert!(json.contains("line\\nbreak.txt"));
1067 assert_eq!(
1068 serde_json::from_str::<serde_json::Value>(&json).unwrap()["entries"][0]["path"],
1069 "line\nbreak.txt"
1070 );
1071 }
1072
1073 #[test]
1074 fn test_json_and_short_are_mutually_exclusive() {

Callers

nothing calls this directly

Calls 2

add_entryMethod · 0.80
unwrapMethod · 0.45

Tested by

no test coverage detected