Files
ElyOffice/tests/scripts/comments-rules.sh
T
ZacharyZhang-NYandClaude Opus 5.5 8a942e6d80 Remove CEF: the web content crate, ElyMark's page, their packaging, licences and tests (C14.5)
PRD and agents.md name the native route; ElyMail's body will not use
CEF or Electron. ElyMark's package carries the KaTeX fonts' OFL.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-12 03:15:30 -04:00

38 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# comments.py fails on long and multi-line comments.
set -euo pipefail
root=$(cd "$(dirname "$0")/../.." && pwd)
work=$(mktemp -d)
trap 'rm -rf "$work"' EXIT
fail() {
echo "FAIL: $*" >&2
exit 1
}
check() { python3 "$root/tests/scripts/comments.py" "$work" >/dev/null 2>&1; }
mkdir -p "$work/site/src" "$work/tests/scripts"
for ext in ts css; do
printf '/* A comment\n spanning lines. */\n' >"$work/site/src/a.$ext"
! check || fail "a multi-line .$ext block comment passed"
printf '/* One two three four five six seven eight nine ten eleven. */\n' >"$work/site/src/a.$ext"
! check || fail "an eleven-word .$ext comment passed"
printf '/* One short line. */\n' >"$work/site/src/a.$ext"
check || fail "a short .$ext comment failed"
rm "$work/site/src/a.$ext"
done
printf 'const a = 1 /* A comment\n spanning lines. */\n' >"$work/site/src/a.ts"
! check || fail "an inline multi-line .ts block comment passed"
printf 'const glob = "/*.css";\n' >"$work/site/src/a.ts"
check || fail "a /* inside a .ts string failed"
printf 'const a = 1; // One two three four five six seven eight nine ten eleven.\n' >"$work/site/src/a.ts"
! check || fail "an eleven-word trailing .ts comment passed"
rm "$work/site/src/a.ts"
printf 'a::after { content: "/*"; }\n' >"$work/site/src/a.css"
check || fail "a /* inside a .css string failed"
printf 'a { color: red; } /* One two three four five six seven eight nine ten eleven. */\n' >"$work/site/src/a.css"
! check || fail "an eleven-word trailing .css comment passed"
rm "$work/site/src/a.css"
printf '// One two three four five six seven eight nine ten eleven.\n' >"$work/tests/scripts/a.swift"
! check || fail "an eleven-word Swift comment passed"
echo "ok: comment rules"