-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtests.sh
executable file
·47 lines (37 loc) · 1005 Bytes
/
tests.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#!/bin/bash
diff_found=false
process_example() {
local example_path=$1
local clar_file=$(find "$example_path" -name "*.clar")
local expected_output_file="$example_path/stdout"
./venv/bin/stacy-analyzer lint "$clar_file" > output.tmp
if ! diff -q output.tmp "$expected_output_file" > /dev/null; then
diff --color output.tmp "$expected_output_file"
diff_found=true
fi
rm output.tmp
}
base_dir="tests"
for test_case in "$base_dir"/*; do
for example in "$test_case"/*; do
if [[ "$example" == *.py ]]; then
continue
fi
if [[ -d "$example" ]]; then
if [[ -t 1 ]]; then
echo "Testing detectors in" "$example"
fi
process_example "$example"
fi
done
done
if [[ -t 1 ]]; then
color_start="\e[32m"
color_end="\e[0m"
else
color_start="=== "
color_end=" ==="
fi
if ! $diff_found; then
echo -e "${color_start}All tests passed.${color_end}"
fi