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:1716–1731  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1714
1715 #[test]
1716 fn test_json_status_escapes_paths() {
1717 let mut status = RepositoryStatus::new("dev".to_string(), None);
1718 status.add_entry(FileStatusEntry::new(
1719 PathBuf::from("line\nbreak.txt"),
1720 FileStatus::Untracked,
1721 ));
1722
1723 let output = JsonStatus::new(&status, std::path::Path::new("/workspace"));
1724 let json = serde_json::to_string(&output).unwrap();
1725
1726 assert!(json.contains("line\\nbreak.txt"));
1727 assert_eq!(
1728 serde_json::from_str::<serde_json::Value>(&json).unwrap()["entries"][0]["path"],
1729 "line\nbreak.txt"
1730 );
1731 }
1732
1733 #[test]
1734 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