-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Introduce function to purge invalid entries from history
- Loading branch information
Showing
3 changed files
with
67 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bats | ||
|
||
setup() { | ||
export TERMINAL_COMMAND='urxvt -e' | ||
export XDG_DATA_HOME=./data/desktop-files/0 | ||
export SLD_DESKTOP_ROOT="$XDG_DATA_HOME/applications/" | ||
export XDG_CACHE_HOME=$BATS_TEST_TMPDIR | ||
export XDG_CONFIG_HOME=./data/autostart-folders/0 | ||
export XDG_CONFIG_DIRS=./data/autostart-folders/1 | ||
export SLD_HIST_FILE="$BATS_TEST_TMPDIR/sway-launcher-desktop.sh-history.txt" | ||
touch "$SLD_HIST_FILE" | ||
|
||
echo "1 ${SLD_DESKTOP_ROOT}firefox.desktopdesktop Firefox" >> "$SLD_HIST_FILE" | ||
echo "1 ${SLD_DESKTOP_ROOT}cjsdalkcnjsaddesktop I wanna be purged" >> "$SLD_HIST_FILE" | ||
echo "1 awkcommand awk" >> "$SLD_HIST_FILE" | ||
echo "1 xksdkasjkslajdslakcommand I wanna be purged" >> "$SLD_HIST_FILE" | ||
echo "1 xksdkasjkslajdslakcommand I wanna be purged too" >> "$SLD_HIST_FILE" | ||
} | ||
|
||
@test "Purge command removes invalid entries" { | ||
run ../sway-launcher-desktop.sh purge | ||
readarray HIST_LINES <"$SLD_HIST_FILE" | ||
# cat "$SLD_HIST_FILE" | ||
echo "$output" | ||
[ "$status" -eq 0 ] | ||
[[ ${#HIST_LINES[@]} == 2 ]] | ||
} |