use std::path::Path;
pub fn yaml_string(value: &str) -> String {
format!(
"\"{}\"",
value
.replace('\\', "\\\\")
.replace('"', "\\\"")
.replace('\n', "\\n")
)
}
pub fn display_path(path: &Path) -> String {
path.to_string_lossy().replace('\\', "/")
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn escapes_yaml_strings() {
assert_eq!(yaml_string("a \"quote\""), "\"a \\\"quote\\\"\"");
}
}