mirror of
https://github.com/lsd-rs/lsd
synced 2024-12-13 21:52:37 +00:00
test: 🔍 use python to create a bad extension
This commit is contained in:
parent
7eeda6c8a2
commit
2ebed2261f
2 changed files with 37 additions and 1 deletions
2
.github/workflows/CICD.yml
vendored
2
.github/workflows/CICD.yml
vendored
|
@ -77,7 +77,7 @@ jobs:
|
|||
shell: bash
|
||||
run: |
|
||||
case ${{ matrix.job.target }} in
|
||||
arm-unknown-linux-gnueabihf) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf ;;
|
||||
arm-unknown-linux-gnueabihf) sudo apt-get -y update ; sudo apt-get -y install gcc-arm-linux-gnueabihf python3 ;;
|
||||
esac
|
||||
- name: Initialize workflow variables
|
||||
id: vars
|
||||
|
|
|
@ -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()
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue