Files
dcr/docs-crowdin-export/ru-RU/docs/commands/quality-commands.mdx.mdx
2026-07-06 03:25:46 +08:00

61 lines
1.7 KiB
Plaintext

---
sidebar_label: Команды качества (test, fmt)
---
# Команды качества
## `dcr test`
Запускает тесты.
```bash
dcr test # debug профиль
dcr test --release # release профиль
dcr test --debug # явный debug
dcr test --help # подробная справка
```
Перед первым запуском нужно инициализировать тесты:
```bash
dcr test --init
```
Это создаёт `tests/dcr_test.h` (фреймворк) и `tests/test.c` (шаблон).
Что делает `dcr test`:
1. Builds the project
2. Collects `tests/*.c` files (`.c` only, not `.cpp`)
3. Compiles and links each test file
4. Runs each test binary
5. Prints summary: TOTAL, PASS, SKIP, FAIL
6. Возвращает ненулевой код при наличии FAIL
## `dcr fmt`
Форматирует исходный код C/C++ через `clang-format`.
```bash
dcr fmt
```
Processes: `src/**/*.{c,cpp,cxx,cc,h,hpp,hxx,hh}` and `tests/**/*.{c,cpp,cxx,cc,h,hpp,hxx,hh}`.
Используется файл `.clang-format` в корне проекта (если есть), иначе дефолтный стиль DCR.
## `dcr lint`
Runs `clang-tidy` on C/C++ source files for static analysis.
```bash
dcr lint # show diagnostics
dcr lint --fix # apply fixes automatically
dcr lint --help # detailed help
```
Processes: `src/**/*.{c,cpp,cxx,cc}` and `tests/**/*.{c,cpp,cxx,cc}`.
Without `--fix`, clang-tidy reports warnings and errors without modifying files.
With `--fix`, clang-tidy applies automatic suggestions in place.