Command Palette

Search for a command to run...

UnylyUnyly
Назад к скиллам

test-style

БесплатноБез исполняемых скриптовНе проверен

How kotatsu's tests are organized and written — levels (unit, system, integration), the module-first layout, dependency and trust rules, naming, zest checks…

clice-ioот clice-io★ 37 звёзд на GitHub

Об этом скилле

kotatsu Test Style

Levels

A test's level is decided by what it touches, not by the module it tests.

Level May touch Lives in
unit the process's memory; an event loop, its timers and in-memory transports count as memory tests/<module>/unit/ → unit_tests
system the operating system: files, processes, sockets, pipes, signals, threads and thread pools, environment tests/<module>/system/ → system_tests
integration several programs talking over real protocols, black box tests/<module>/integration/ → ctest
  • The moment a test opens a file, spawns a process, binds a socket, installs a signal handler or starts a thread, it is a system test. zest's own I/O does not count: printing, and reading or writing snapshots through zest::snapshot, are fine in a unit test.
  • Compile-time facts that must hold are ZSTATIC_EXPECT in a unit case.
  • Nothing reaches the network beyond loopback. Tests that need the internet are not part of any suite.
  • A target that must build without another, as ipc's codecs without the event loop, is checked by a program linked against it alone, without zest, which needs the loop; so is a check that replaces what a whole process shares, as fs's of remove_all() under failing allocations replaces the global operator new: tests/<module>/<name>/main.cpp, run by ctest and Bazel as <module>_<name> (label unit, or system for one that touches the operating system); it prints each failed check and exits with 1.
  • zest's own runner check (tests/zest/integration/) is integration-level, but it is the one integration test in C++ and CMake rather than TypeScript: it runs from CMake as a bootstrap stage (see Trust), so it needs nothing beyond the build.

Layout

Tests are grouped by module, then by level. tests/<module>/ mirrors include/kotatsu/<module>/; the modules are support, fs, sys, meta, codec with one directory per backend (codec/json, codec/toml, codec/fbs, codec/bincode, codec/blob, codec/dyn, codec/debug), cli, async, ipc with ipc/lsp, http and zest. tests/examples/ holds the tests of examples/, by the module an example shows (tests/examples/async/, tests/examples/ipc/): unit tests of what an example builds on, and the example programs run end to end. tests/harness/ holds what every module's integration tests share.

tests/<module>/
  unit/<path mirroring the headers>/...
  system/...                  same shape
  integration/*.test.ts       integration tests, TypeScript; nothing else but drivers/
  integration/drivers/*.cpp   the programs they spawn, one per file, or one per
                              directory of sources
  <name>/main.cpp             a check that is a program of its own (Levels),
                              in kotatsu_check_programs so that it builds into the
                              build root beside the runtime DLLs
  harness/*.h, harness/*.ts   helpers for this module's tests and the modules above,
                              integration tests' helpers included
  CMakeLists.txt              kotatsu_add_module_tests(LIBS <the module's libraries>)
                              kotatsu_add_integration_tests(LIBS ... PROGRAMS ...
                              DEBUG_ONLY ...) if it has integration/; PROGRAMS are
                              targets built elsewhere
tests/BUILD.bazel             the same for Bazel: each module's harness library,
                              its <module>_<level>_tests binaries, its drivers and
                              its <module>_integration test
tests/harness/*.ts            what every module's integration tests share
tests/fixtures/               types shared by several modules' tests
tests/snapshots/<suite>/      snapshot files
  • The tests of header <module>/a/b.h are unit/a/b_tests.cpp. A large header's tests split by aspect, into unit/a/b_<aspect>_tests.cpp or into a directory unit/a/b/<aspect>_tests.cpp.
  • codec's protocol (the core headers in codec/, codec::repr, attributes, formats) is tested once, by a kit every backend runs: codec/harness/visit/kit.h holds the primitives and Caps, and each area (values.h, attrs.h, repr.h, variants.h, probing.h) registers its cases for a backend. A backend adapts itself in codec/<backend>/harness/backend.h and runs each area in codec/<backend>/unit/visit/<area>_tests.cpp, one ZEST_CASE_GROUP per file; blob, which lays out the struct itself rather than speaking the protocol, has no visit/ tests. Fixtures only the codec's tests use live in codec/harness/fixtures/.
Полный SKILL.md на GitHub

Установить test-style в Claude Code и Claude Desktop

Зарегайся, чтобы установить скилл

Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.

  • Открой команду установки в одну строку
  • Сохраняй скиллы в синхронизируемую библиотеку
  • Уведомления, когда скиллы обновляются
Зарегаться бесплатноУ меня уже есть аккаунт

Разрешённые инструменты

Инструменты, которые скиллу разрешено вызывать.

Без ограничений — скилл может использовать любой инструмент.

FAQ

Что делает скилл test-style?

How kotatsu's tests are organized and written — levels (unit, system, integration), the module-first layout, dependency and trust rules, naming, zest checks, determinism. Read BEFORE writing, moving or reviewing any test.

Как установить скилл test-style?

Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.

Скилл test-style запускает скрипты?

Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.

Похожие скиллы

Сравнить test-style с