feat: suggestion tests

This commit is contained in:
iff 2025-04-05 00:10:29 +02:00
parent 58b6a65a75
commit 5a4ef05828
7 changed files with 95 additions and 0 deletions

6
tests/cases/file_path Normal file
View file

@ -0,0 +1,6 @@
case="file path typo"
command="cd ./correc"
error="no such file or directory"
expect="cd ./correct"
mkdir -p correct

4
tests/cases/privilege Normal file
View file

@ -0,0 +1,4 @@
case="privilege"
command="pacman -Syu"
error="you cannot perform this operation unless you are root"
expect="sudo pacman -Syu"

7
tests/cases/regex_cmd Normal file
View file

@ -0,0 +1,7 @@
case="regex: command"
command="touch dir/file"
error="no such file or directory"
expect="\
mkdir --parents dir/ &&
touch dir/file\
"

7
tests/cases/regex_err Normal file
View file

@ -0,0 +1,7 @@
case="regex: error"
command="cargo built"
error="
error: no such command: \`built\`
Did you mean \`build\`?
"
expect="cargo build"

6
tests/cases/regex_opt Normal file
View file

@ -0,0 +1,6 @@
case="regex: options"
command="rm correc -r"
error="no such file or directory"
expect="rm -r ./correct"
mkdir -p correct

4
tests/cases/typo Normal file
View file

@ -0,0 +1,4 @@
case="command typo"
command="echp"
error="command not found"
expect="echo"