[shell_shortcuts] fix test by adding dir to / that will match $e1

This commit is contained in:
Will Owens
2024-02-23 04:26:43 -05:00
parent a46e383a93
commit 5f58628d8a

View File

@@ -49,6 +49,8 @@ oneTimeSetUp() {
# Test already wrapped commands # Test already wrapped commands
alias cat="exec_scmb_expand_args $cat_path" alias cat="exec_scmb_expand_args $cat_path"
sudo mkdir /aaa
# Run shortcut wrapping # Run shortcut wrapping
source "$scmbDir/lib/git/shell_shortcuts.sh" source "$scmbDir/lib/git/shell_shortcuts.sh"
@@ -141,10 +143,14 @@ test_ls_with_file_shortcuts() {
assertFalse 'Fails on <directory> <directory>/<file>' 'ls_with_file_shortcuts 1 1/file' assertFalse 'Fails on <directory> <directory>/<file>' 'ls_with_file_shortcuts 1 1/file'
# Files under the root directory # Files under the root directory
assertTrue 'Shortcuts under /' 'ls_with_file_shortcuts / > /dev/null && [[ $e1 =~ ^/[^/]+$ ]]' assertTrue 'Shortcuts under /' 'ls_with_file_shortcuts / >/dev/null && [[ $e1 =~ ^/[^/]+$ ]]'
ls_with_file_shortcuts / >/dev/null
assertTrue "$e1 == /aaa" '[[ "$e1" == "/aaa" ]]'
cd - cd -
rm -r "$TEST_DIR" "$temp_file" rm -r "$TEST_DIR" "$temp_file"
sudo rmdir /aaa
} }
# load and run shUnit2 # load and run shUnit2