From 50822d9e135b462604cae74bcfcc7ea6025328c9 Mon Sep 17 00:00:00 2001 From: cloud0x42 Date: Tue, 14 Oct 2025 21:49:31 +0200 Subject: [PATCH] Add test script --- README.md | 3 ++- tests/test.sh | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) create mode 100755 tests/test.sh diff --git a/README.md b/README.md index 98e512d..d23d1e6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Git demo -This project contains 5 bash scripts, and 3 branches we can use for testing. +This project contains 5 bash scripts, and 3 branches we can use for testing. The testing script validates that the **scripts/** directory contains executable .sh files. + diff --git a/tests/test.sh b/tests/test.sh new file mode 100755 index 0000000..0d072ae --- /dev/null +++ b/tests/test.sh @@ -0,0 +1,17 @@ +#!/bin/bash + +set -e + +# validate that the scripts folder only has .sh files +if [[ $(find scripts -type f -not -name "*.sh") ]]; then + echo "Error: scripts folder contains non-bash files" + exit 1 +fi + +# validate all scripts are executable +for file in scripts/*.sh; do + if [[ ! -x "$file" ]]; then + echo "Error: $file is not executable" + exit 1 + fi +done