'Generic Commit'
This commit is contained in:
@ -2,7 +2,7 @@
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
WHATSDIRTY_SCRIPT="$SCRIPT_DIR/whatsdirty.sh"
|
||||
WHATSDIRTY_SCRIPT="$SCRIPT_DIR/whatsdirty"
|
||||
CONFIG_FILE="$HOME/.config/whatsdirty.conf"
|
||||
BACKUP_FILE=""
|
||||
TEST_PASSED=true
|
||||
@ -25,7 +25,12 @@ print_test() {
|
||||
}
|
||||
|
||||
# Function to cleanup and restore
|
||||
CLEANED=false
|
||||
cleanup() {
|
||||
if [ "$CLEANED" = true ]; then
|
||||
return
|
||||
fi
|
||||
CLEANED=true
|
||||
if [ -n "$BACKUP_FILE" ] && [ -f "$BACKUP_FILE" ]; then
|
||||
cp "$BACKUP_FILE" "$CONFIG_FILE"
|
||||
rm -f "$BACKUP_FILE"
|
||||
@ -38,7 +43,7 @@ cleanup() {
|
||||
# Set up trap to restore config on exit
|
||||
trap cleanup EXIT
|
||||
|
||||
echo "Testing whatsdirty.sh configuration behavior..."
|
||||
echo "Testing whatsdirty configuration behavior..."
|
||||
echo "Working directory: $(pwd)"
|
||||
echo "Script path: $WHATSDIRTY_SCRIPT"
|
||||
echo "Config file: $CONFIG_FILE"
|
||||
@ -148,6 +153,8 @@ else
|
||||
echo " Got: $OUTPUT"
|
||||
fi
|
||||
|
||||
cleanup
|
||||
|
||||
# Summary
|
||||
echo
|
||||
if [ "$TEST_PASSED" = true ]; then
|
||||
@ -156,4 +163,5 @@ if [ "$TEST_PASSED" = true ]; then
|
||||
else
|
||||
echo -e "${RED}Some tests failed!${NC}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Reference in New Issue
Block a user