Tests, licence, and the tooling to keep the repo consistent
A test suite with no dependencies beyond bash and the Python standard library, run by one command: scripts/test.sh (or: make test) scripts/test.sh --windows [host] adds the PowerShell suite over SSH - tests/static.sh: script syntax, JSON validity, VERSION against the widget manifest and CHANGELOG, providers.json against the kinds, probes and checks the code implements (and ids that would shadow a command), qmllint and shellcheck when installed. - tests/python: unit tests for cm-json.py - providers and the column contract bash depends on, the original three scaffolds byte for byte, every catalogue parser and the cache, session scan/dismiss/repair, rename, defaults, health, the cost guard. - tests/cli: the CLI in a sandbox with its own HOME, CM_ROOT, CLAUDE_CONFIG_DIR and a file-only vault, against fake Ollama, LM Studio, keyed-gateway and proxy servers - preflight, presets, models, doctor, a real switch, sessions, and the key helper under a rename race. - tests/windows: the same idea on a Windows host, with USERPROFILE pointed at a temp folder so the real install is never touched. Also: MIT licence, CHANGELOG.md reconstructed from history, .editorconfig and .gitattributes pinning LF everywhere (what the tree already is), and scripts/bump-version.sh, since the version lives in two files and drifted once before. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Executable
+27
@@ -0,0 +1,27 @@
|
||||
#!/usr/bin/env bash
|
||||
# Every provider in providers.json is a mode: listed, dispatched, aliased.
|
||||
. "$(dirname "$0")/../lib.sh"
|
||||
|
||||
run_cm --help
|
||||
for id in openrouter zai lmstudio ollama custom; do
|
||||
expect_out "claude-mode $id [preset]" "usage lists $id"
|
||||
done
|
||||
|
||||
run_cm presets
|
||||
expect_out 'ollama' 'presets lists ollama'
|
||||
expect_out 'custom' 'presets lists custom'
|
||||
|
||||
for word in zai Z.AI z-ai lm-studio OLLAMA; do
|
||||
code="$(preflight_code "$word")"
|
||||
expect_eq "${code%% *}" needs-setup "preflight resolves '$word'"
|
||||
done
|
||||
|
||||
run_cm nope
|
||||
expect_rc 1 'an unknown command fails'
|
||||
expect_out "unknown command 'nope'" 'and says so'
|
||||
|
||||
run_cm preset default
|
||||
expect_out 'ollama ollama (built-in)' 'ollama has a built-in default'
|
||||
expect_out 'custom custom (built-in)' 'custom has a built-in default'
|
||||
|
||||
finish
|
||||
Reference in New Issue
Block a user