Skip to content

Commit 56f30cd

Browse files
committed
Add more tests
1 parent c1d5f09 commit 56f30cd

File tree

3 files changed

+62
-23
lines changed

3 files changed

+62
-23
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ repos:
1010
- id: check-toml
1111
- id: requirements-txt-fixer
1212
- repo: https://github.com/astral-sh/ruff-pre-commit
13-
rev: v0.13.1
13+
rev: v0.14.2
1414
hooks:
1515
# Run the linter.
1616
- id: ruff-check
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
repos:
2+
- repo: .
3+
rev: HEAD
4+
hooks:
5+
- id: clang-format
6+
args: [--style=LLVM, --version=16] # to load .clang-format
7+
- id: clang-tidy
8+
args: [--checks=.clang-tidy, --version=16] # path/to/.clang-tidy
9+
- repo: .
10+
rev: HEAD
11+
hooks:
12+
- id: clang-format
13+
args: [--style=Google, --version=17]
14+
- id: clang-tidy
15+
args: [--checks=.clang-tidy, --version=17]
16+
- repo: .
17+
rev: HEAD
18+
hooks:
19+
- id: clang-format
20+
args: [--style=Microsoft, --version=18]
21+
- id: clang-tidy
22+
args: [--checks=.clang-tidy, --version=18]
23+
- repo: .
24+
rev: HEAD
25+
hooks:
26+
- id: clang-format
27+
args: [--style=WebKit, --version=19]
28+
- id: clang-tidy
29+
args: [--checks=.clang-tidy, --version=19]
30+
- repo: .
31+
rev: HEAD
32+
hooks:
33+
- id: clang-format
34+
args: [--style=Mozilla, --version=20]
35+
- id: clang-tidy
36+
args: [--checks=.clang-tidy, --version=20]
37+
- repo: .
38+
rev: HEAD
39+
hooks:
40+
- id: clang-format
41+
args: [--style=Chromium, --version=21]
42+
- id: clang-tidy
43+
args: [--checks=.clang-tidy, --version=21]

testing/run.sh

Lines changed: 18 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,31 @@
11
#!/bin/bash
2-
echo "==========================="
3-
echo "Test pre-commit-config.yaml"
4-
echo "==========================="
5-
pre-commit clean
6-
pre-commit run -c testing/pre-commit-config.yaml --files testing/main.c | tee -a result.txt || true
7-
git restore testing/main.c
82

9-
echo "===================================="
10-
echo "Test pre-commit-config-version.yaml"
11-
echo "===================================="
12-
pre-commit clean
13-
pre-commit run -c testing/pre-commit-config-version.yaml --files testing/main.c | tee -a result.txt || true
14-
git restore testing/main.c
3+
configs=(
4+
"pre-commit-config.yaml"
5+
"pre-commit-config-version.yaml"
6+
"pre-commit-config-verbose.yaml"
7+
"pre-commit-config-style.yaml"
8+
)
159

16-
echo "===================================="
17-
echo "Test pre-commit-config-verbose.yaml"
18-
echo "===================================="
19-
pre-commit clean
20-
pre-commit run -c testing/pre-commit-config-verbose.yaml --files testing/main.c | tee -a result.txt || true
21-
git restore testing/main.c
10+
for config in "${configs[@]}"; do
11+
echo "===================================="
12+
echo "Test $config"
13+
echo "===================================="
14+
pre-commit clean
15+
pre-commit run -c testing/$config --files testing/main.c | tee -a result.txt || true
16+
git restore testing/main.c
17+
done
2218

2319
echo "=================================================================================="
24-
echo "print result.txt"
20+
echo "Print result.txt"
2521
cat result.txt
2622
echo "=================================================================================="
2723

28-
failed_cases=`grep -c "Failed" result.txt`
24+
failed_cases=$(grep -c "Failed" result.txt)
2925

30-
echo $failed_cases " cases failed."
26+
echo "$failed_cases cases failed."
3127

32-
if [ $failed_cases -eq 10 ]; then
28+
if [[ $failed_cases -eq 10 ]]; then
3329
echo "=============================="
3430
echo "Test cpp-linter-hooks success."
3531
echo "=============================="

0 commit comments

Comments
 (0)