Skip to content

Commit 52773cd

Browse files
Fix script
1 parent 3a8db0c commit 52773cd

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

tools/test.sh

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,24 @@ TIER3="examples/frontend examples/markdown_editor examples/reflux_demo/web_count
3333
# Exclusion list (package names to skip)
3434
EXCLUDED="too_many_cooks too_many_cooks_vscode_extension"
3535

36+
# Helper functions
37+
is_type() {
38+
local name=$(basename "$1")
39+
local list="$2"
40+
[[ " $list " =~ " $name " ]]
41+
}
42+
43+
is_excluded() {
44+
local name=$(basename "$1")
45+
[[ " $EXCLUDED " =~ " $name " ]]
46+
}
47+
48+
calc_coverage() {
49+
local lcov="$1"
50+
[[ -f "$lcov" ]] || { echo "0"; return; }
51+
awk -F: '/^LF:/ { total += $2 } /^LH:/ { covered += $2 } END { if (total > 0) printf "%.1f", (covered / total) * 100; else print "0" }' "$lcov"
52+
}
53+
3654
# Parse arguments
3755
TIER=""
3856
PACKAGES=()
@@ -73,24 +91,6 @@ TEST_PATHS=("${FILTERED_PATHS[@]}")
7391

7492
mkdir -p "$LOGS_DIR"
7593

76-
# Helper functions
77-
is_type() {
78-
local name=$(basename "$1")
79-
local list="$2"
80-
[[ " $list " =~ " $name " ]]
81-
}
82-
83-
is_excluded() {
84-
local name=$(basename "$1")
85-
[[ " $EXCLUDED " =~ " $name " ]]
86-
}
87-
88-
calc_coverage() {
89-
local lcov="$1"
90-
[[ -f "$lcov" ]] || { echo "0"; return; }
91-
awk -F: '/^LF:/ { total += $2 } /^LH:/ { covered += $2 } END { if (total > 0) printf "%.1f", (covered / total) * 100; else print "0" }' "$lcov"
92-
}
93-
9494
# Test a single package (runs in subshell)
9595
test_package() {
9696
local dir="$1"

0 commit comments

Comments
 (0)