diff options
author | zwPapEr <zw.paper@gmail.com> | 2020-10-06 22:21:32 +0800 |
---|---|---|
committer | Abin Simon <abinsimon10@gmail.com> | 2020-10-18 10:51:26 +0530 |
commit | 2ebed2261fd05486c90ff8a0ebeb6b8d4dddea34 (patch) | |
tree | 6cf1154bda96036f5e0f5346f9864d53bd22c7c8 /tests | |
parent | 7eeda6c8a26fc7a49ba0ad9d2b2afd4a73df9dc5 (diff) |
test: :mag: use python to create a bad extension
Diffstat (limited to 'tests')
-rw-r--r-- | tests/integration.rs | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/tests/integration.rs b/tests/integration.rs index e853b15..6f35c55 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -362,6 +362,42 @@ fn test_version_sort_overwrite_by_sizesort() { .stdout(predicate::str::is_match("11\n2\n$").unwrap()); } +#[test] +#[cfg(target_os = "linux")] +fn test_bad_utf_8_extension() { + let tmp = tempdir(); + Command::new("python3") + .arg("-c") + .arg(format!( + r#"import pathlib; pathlib.Path('{}/bad.extension\udca7\udcfd').touch()"#, + tmp.path().to_str().unwrap() + )) + .output() + .expect("failed to create file"); + cmd() + .arg(tmp.path()) + .assert() + .stdout(predicate::str::is_match("bad.extension\u{fffd}\u{fffd}\n$").unwrap()); +} + +#[test] +#[cfg(target_os = "linux")] +fn test_bad_utf_8_name() { + let tmp = tempdir(); + Command::new("python3") + .arg("-c") + .arg(format!( + r#"import pathlib; pathlib.Path('{}/bad-name\udca7\udcfd.ext').touch()"#, + tmp.path().to_str().unwrap() + )) + .output() + .expect("failed to create file"); + cmd() + .arg(tmp.path()) + .assert() + .stdout(predicate::str::is_match("bad-name\u{fffd}\u{fffd}.ext\n$").unwrap()); +} + fn cmd() -> Command { Command::cargo_bin(env!("CARGO_PKG_NAME")).unwrap() } |