Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
ContenT
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
ContenT
Commits
aa131aa2
Commit
aa131aa2
authored
Feb 16, 2026
by
Roman Alifanov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update README with @test decorator documentation
parent
b37f6664
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
100 additions
and
2 deletions
+100
-2
README.md
README.md
+50
-1
README_ru.md
README_ru.md
+50
-1
No files found.
README.md
View file @
aa131aa2
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
-
**Clean syntax**
— Python-like readability with Go/Vala influences
-
**Clean syntax**
— Python-like readability with Go/Vala influences
-
**Classes & inheritance**
— OOP with constructors and method calls
-
**Classes & inheritance**
— OOP with constructors and method calls
-
**Lambdas**
—
`x => x * 2`
,
`(a, b) => a + b`
, multiline blocks
-
**Lambdas**
—
`x => x * 2`
,
`(a, b) => a + b`
, multiline blocks
-
**Decorators**
—
`@retry`
,
`@log`
,
`@cache`
,
`@awk`
-
**Decorators**
—
`@retry`
,
`@log`
,
`@cache`
,
`@awk`
,
`@test`
-
**Pipe operator**
— shell-like
`|`
for command chaining and functional composition
-
**Pipe operator**
— shell-like
`|`
for command chaining and functional composition
-
**Error handling**
—
`try/except/finally/throw/defer`
-
**Error handling**
—
`try/except/finally/throw/defer`
-
**String interpolation**
—
`"Hello, {name}!"`
-
**String interpolation**
—
`"Hello, {name}!"`
...
@@ -110,6 +110,12 @@ func fast_sum (text) {
...
@@ -110,6 +110,12 @@ func fast_sum (text) {
}
}
return total
return total
}
}
@test ("addition works correctly")
func test_add () {
result = 2 + 3
assert (result == 5, "2 + 3 should be 5")
}
```
```
### Control Flow
### Control Flow
...
@@ -185,6 +191,9 @@ content build . -o app.sh # all .ct in directory
...
@@ -185,6 +191,9 @@ content build . -o app.sh # all .ct in directory
content run main.ct
content run main.ct
content run main.ct
--
arg1 arg2
# with arguments
content run main.ct
--
arg1 arg2
# with arguments
# Test
content
test
main.ct
# run @test functions
# Build library
# Build library
content
--build-lib
MyLib.ct
# -> MyLib.sh
content
--build-lib
MyLib.ct
# -> MyLib.sh
...
@@ -255,6 +264,46 @@ class Calculator {
...
@@ -255,6 +264,46 @@ class Calculator {
Uses
`mawk`
(preferred) or
`gawk`
for maximum speed.
Uses
`mawk`
(preferred) or
`gawk`
for maximum speed.
## @test — Built-in Testing
The
`@test`
decorator marks functions as tests. Run with
`content test`
.
```
@test ("string operations work")
func test_strings () {
text = "hello"
assert (text.len () == 5, "length should be 5")
assert (text.upper () == "HELLO", "uppercase should work")
}
@test ("awk functions work")
func test_awk () {
result = fast_sum ("1 2 3")
assert (result == 6, "sum should be 6")
}
```
**Features:**
-
`assert(condition, message)`
— works in both bash and @awk functions
-
Colored output with timing for each test
-
Tests are skipped in normal compilation (DCE)
-
Combine with other decorators:
`@test @awk`
**Output example:**
```
Running 3 tests...
RUN string operations work
PASS string operations work (2ms)
RUN awk functions work
PASS awk functions work (4ms)
RUN failing test
FAIL failing test (1ms)
expected 10 but got 5
2 of 3 tests passed
```
## Documentation
## Documentation
-
[
Language Specification
](
LANGUAGE_SPEC.md
)
-
[
Language Specification
](
LANGUAGE_SPEC.md
)
...
...
README_ru.md
View file @
aa131aa2
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
-
**Чистый синтаксис**
— читаемость Python с влиянием Go/Vala
-
**Чистый синтаксис**
— читаемость Python с влиянием Go/Vala
-
**Классы и наследование**
— ООП с конструкторами и вызовами методов
-
**Классы и наследование**
— ООП с конструкторами и вызовами методов
-
**Лямбды**
—
`x => x * 2`
,
`(a, b) => a + b`
, многострочные блоки
-
**Лямбды**
—
`x => x * 2`
,
`(a, b) => a + b`
, многострочные блоки
-
**Декораторы**
—
`@retry`
,
`@log`
,
`@cache`
,
`@awk`
-
**Декораторы**
—
`@retry`
,
`@log`
,
`@cache`
,
`@awk`
,
`@test`
-
**Pipe-оператор**
— shell-like
`|`
для цепочек команд и функциональной композиции
-
**Pipe-оператор**
— shell-like
`|`
для цепочек команд и функциональной композиции
-
**Обработка ошибок**
—
`try/except/finally/throw/defer`
-
**Обработка ошибок**
—
`try/except/finally/throw/defer`
-
**Строковая интерполяция**
—
`"Привет, {name}!"`
-
**Строковая интерполяция**
—
`"Привет, {name}!"`
...
@@ -110,6 +110,12 @@ func fast_sum (text) {
...
@@ -110,6 +110,12 @@ func fast_sum (text) {
}
}
return total
return total
}
}
@test ("сложение работает")
func test_add () {
result = 2 + 3
assert (result == 5, "2 + 3 должно быть 5")
}
```
```
### Управление потоком
### Управление потоком
...
@@ -185,6 +191,9 @@ content build . -o app.sh # все .ct в директории
...
@@ -185,6 +191,9 @@ content build . -o app.sh # все .ct в директории
content run main.ct
content run main.ct
content run main.ct
--
arg1 arg2
# с аргументами
content run main.ct
--
arg1 arg2
# с аргументами
# Тестирование
content
test
main.ct
# запуск @test функций
# Сборка библиотеки
# Сборка библиотеки
content
--build-lib
MyLib.ct
# -> MyLib.sh
content
--build-lib
MyLib.ct
# -> MyLib.sh
...
@@ -255,6 +264,46 @@ class Calculator {
...
@@ -255,6 +264,46 @@ class Calculator {
Использует
`mawk`
(предпочтительно) или
`gawk`
для максимальной скорости.
Использует
`mawk`
(предпочтительно) или
`gawk`
для максимальной скорости.
## @test — Встроенное тестирование
Декоратор
`@test`
помечает функции как тесты. Запуск через
`content test`
.
```
@test ("строковые операции работают")
func test_strings () {
text = "hello"
assert (text.len () == 5, "длина должна быть 5")
assert (text.upper () == "HELLO", "uppercase должен работать")
}
@test ("awk функции работают")
func test_awk () {
result = fast_sum ("1 2 3")
assert (result == 6, "сумма должна быть 6")
}
```
**Возможности:**
-
`assert(condition, message)`
— работает в bash и @awk функциях
-
Цветной вывод с временем для каждого теста
-
Тесты пропускаются при обычной компиляции (DCE)
-
Комбинируется с другими декораторами:
`@test @awk`
**Пример вывода:**
```
Running 3 tests...
RUN строковые операции работают
PASS строковые операции работают (2ms)
RUN awk функции работают
PASS awk функции работают (4ms)
RUN падающий тест
FAIL падающий тест (1ms)
ожидалось 10, получено 5
2 of 3 tests passed
```
## Документация
## Документация
-
[
Спецификация языка
](
LANGUAGE_SPEC.md
)
-
[
Спецификация языка
](
LANGUAGE_SPEC.md
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment