mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Add test
This commit is contained in:
parent
655222d6e4
commit
90b6f7d098
1 changed files with 3 additions and 1 deletions
|
|
@ -17,7 +17,7 @@ pub fn escape_os_bytes(b: &[u8]) -> Cow<'_, [u8]> {
|
||||||
} else {
|
} else {
|
||||||
if c == b'"' {
|
if c == b'"' {
|
||||||
buf.extend((0..backslashes).map(|_| b'\\'));
|
buf.extend((0..backslashes).map(|_| b'\\'));
|
||||||
buf.push(b'"')
|
buf.push(b'"');
|
||||||
} else if c == b'%' {
|
} else if c == b'%' {
|
||||||
buf.extend_from_slice(b"%%cd:~,");
|
buf.extend_from_slice(b"%%cd:~,");
|
||||||
} else if c == b'\r' || c == b'\n' {
|
} else if c == b'\r' || c == b'\n' {
|
||||||
|
|
@ -120,6 +120,8 @@ mod tests {
|
||||||
(br#""--features=\"default\"""#, br#""""--features=\\""default\\""""""#),
|
(br#""--features=\"default\"""#, br#""""--features=\\""default\\""""""#),
|
||||||
// Complex command
|
// Complex command
|
||||||
(b"linker=gcc -L/foo -Wl,bar", br#""linker=gcc -L/foo -Wl,bar""#),
|
(b"linker=gcc -L/foo -Wl,bar", br#""linker=gcc -L/foo -Wl,bar""#),
|
||||||
|
// Variable expansion
|
||||||
|
(b"%APPDATA%.txt", br#""%%cd:~,%APPDATA%%cd:~,%.txt""#),
|
||||||
// Unicode characters
|
// Unicode characters
|
||||||
("이것은 테스트".as_bytes(), r#""이것은 테스트""#.as_bytes()),
|
("이것은 테스트".as_bytes(), r#""이것은 테스트""#.as_bytes()),
|
||||||
];
|
];
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue