11#! /bin/bash
22# 2 Failed cases are expected
3+ echo " ==========================="
4+ echo " Test pre-commit-config.yaml"
5+ echo " ==========================="
36pre-commit clean
47pre-commit run -c testing/pre-commit-config.yaml --files testing/main.c | tee -a result.txt || true
58git restore testing/main.c
69
710# 10 Failed cases are expected
11+ echo " ===================================="
12+ echo " Test pre-commit-config-version.yaml"
13+ echo " ===================================="
814pre-commit clean
915pre-commit run -c testing/pre-commit-config-version.yaml --files testing/main.c | tee -a result.txt || true
1016git restore testing/main.c
11- cat result.txt
1217
1318# 2 Failed cases are expected
19+ echo " ===================================="
20+ echo " Test pre-commit-config-verbose.yaml"
21+ echo " ===================================="
1422pre-commit clean
1523pre-commit run -c testing/pre-commit-config-verbose.yaml --files testing/main.c | tee -a result.txt || true
1624git restore testing/main.c
25+
26+ echo " ===================================="
27+ echo " print result.txt"
1728cat result.txt
29+ echo " ===================================="
1830
1931failed_cases=` grep -c " Failed" result.txt`
2032
@@ -24,8 +36,8 @@ if [ $failed_cases -eq 10 ]; then
2436 echo " =============================="
2537 echo " Test cpp-linter-hooks success."
2638 echo " =============================="
27- exit 0
2839 rm result.txt
40+ exit 0
2941else
3042 echo " ============================="
3143 echo " Test cpp-linter-hooks failed."
0 commit comments