Skip to content

Commit

Permalink
Test
Browse files Browse the repository at this point in the history
  • Loading branch information
jarelllama authored Apr 1, 2024
1 parent d1a27f7 commit 226dea2
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions functions/test_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,15 @@ TEST_PARKED_CHECK() {
check_and_exit
}

# Function 'TEST_BUILD' verifies that the various formats of blocklist
# are correctly built with the right syntax.
TEST_BUILD() {
domain='build-test.com'
printf "%s\n" "$domain" >> "$RAW"
cp "$RAW" "$RAW_LIGHT"
touch out_.txt # Placeholder

bash functions/build_lists.sh

# TODO: check exit status
run_script build_lists.sh --no-output

check_list "||${domain}^" adblock
check_list "local=/${domain}/" dnsmasq
Expand All @@ -270,9 +271,6 @@ TEST_BUILD() {
# $1: syntax to check for
# $2: name and directory of format
check_list() {

head -n 50 "lists/${2}/scams.txt"

# Check regular version
if ! grep -qxF "$1" "lists/${2}/scams.txt"; then
printf "\e[1m[warn] %s format is not as expected:\e[0m\n" "$2"
Expand Down Expand Up @@ -578,12 +576,12 @@ run_script() {
done

printf "\e[1m[start] %s\e[0m\n" "$1"
printf "%s\n" "----------------------------------------------------------------------"
[[ "$2" == '--no-output' ]] && printf "%s\n" "----------------------------------------------------------------------"

# Run script
bash "functions/${1}" || errored=true

printf "%s\n" "----------------------------------------------------------------------"
[[ "$2" == '--no-output' ]] && printf "%s\n" "----------------------------------------------------------------------"

# Return 1 if script has an exit status of 1
if [[ "$errored" == true ]]; then
Expand Down

0 comments on commit 226dea2

Please sign in to comment.