-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_playground.sh
More file actions
85 lines (71 loc) · 2.92 KB
/
test_playground.sh
File metadata and controls
85 lines (71 loc) · 2.92 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
#!/bin/bash
# Regression tests for the ChaiScript website build artifacts.
# Validates that all required files exist and contain expected content.
set -euo pipefail
REPO_ROOT="$(cd "$(dirname "$0")" && pwd)"
FAIL=0
assert_file_exists() {
if [ ! -f "$REPO_ROOT/$1" ]; then
echo "FAIL: $1 does not exist"
FAIL=1
else
echo "PASS: $1 exists"
fi
}
assert_file_contains() {
if ! grep -q "$2" "$REPO_ROOT/$1" 2>/dev/null; then
echo "FAIL: $1 does not contain '$2'"
FAIL=1
else
echo "PASS: $1 contains '$2'"
fi
}
# 1. GitHub Actions workflow exists and runs hourly
assert_file_exists ".github/workflows/update-wasm.yml"
assert_file_contains ".github/workflows/update-wasm.yml" "schedule"
assert_file_contains ".github/workflows/update-wasm.yml" "cron:"
assert_file_contains ".github/workflows/update-wasm.yml" "wasm-latest"
assert_file_contains ".github/workflows/update-wasm.yml" "ChaiScript/ChaiScript"
# 2. Playground page exists with required elements
assert_file_exists "playground.html"
assert_file_contains "playground.html" "chaiscript.js"
assert_file_contains "playground.html" "Module"
assert_file_contains "playground.html" "header.html"
# 3. Navigation includes playground link
assert_file_contains "_includes/header.html" "playground"
# 4. Grammar railroad diagram workflow exists and runs hourly
assert_file_exists ".github/workflows/update-grammar.yml"
assert_file_contains ".github/workflows/update-grammar.yml" "schedule"
assert_file_contains ".github/workflows/update-grammar.yml" "cron:"
assert_file_contains ".github/workflows/update-grammar.yml" "chaiscript.ebnf"
assert_file_contains ".github/workflows/update-grammar.yml" "ChaiScript/ChaiScript"
assert_file_contains ".github/workflows/update-grammar.yml" "rr-webapp"
# 5. Grammar page exists with required elements
assert_file_exists "grammar.html"
assert_file_contains "grammar.html" "header.html"
assert_file_contains "grammar.html" "railroad"
# 6. Navigation includes grammar link
assert_file_contains "_includes/header.html" "grammar"
# 7. Playground has examples sidebar
assert_file_contains "playground.html" "examples-sidebar"
assert_file_contains "playground.html" "example-item"
# 8. Playground has live execution with debounce
assert_file_contains "playground.html" "debounceTimer"
assert_file_contains "playground.html" "addEventListener.*input"
# 9. Playground examples cover major ChaiScript features
assert_file_contains "playground.html" "Variables & Types"
assert_file_contains "playground.html" "Functions"
assert_file_contains "playground.html" "Loops"
assert_file_contains "playground.html" "Strings"
assert_file_contains "playground.html" "Vectors & Maps"
assert_file_contains "playground.html" "Classes"
assert_file_contains "playground.html" "Lambdas"
assert_file_contains "playground.html" "Error Handling"
if [ "$FAIL" -ne 0 ]; then
echo ""
echo "RESULT: SOME TESTS FAILED"
exit 1
fi
echo ""
echo "RESULT: ALL TESTS PASSED"
exit 0