sections
`Section` macro with BDD aliases for testing
Summary
| Latest Version | Unknown |
|---|---|
| License | MIT |
| CI Status | Failing |
| Downloads | 0 |
| Last Indexed | 2026-07-21 05:24 |
Tags
Installation
nimble install sections
choosenim install sections
git clone https://github.com/c0ffeeartc/nim-sections
OS Compatibility
| Platform | Linux | macOS | Windows | FreeBSD | OpenBSD | NetBSD | Android | iOS | WASM | Embedded |
|---|---|---|---|---|---|---|---|---|---|---|
| sections | ✓ | ✓ | ✓ | - | - | - | - | - | - | - |
Source
| Repository | https://github.com/c0ffeeartc/nim-sections |
|---|---|
| Homepage | https://github.com/c0ffeeartc/nim-sections |
| Registry Source | nimble_official |
README
nim-sections
Provides Section macro and its Given, When, Then aliases. Nested Section blocks are converted into separate local branches of execution.
Inspired by C++ Catch Test Framework sections
Installation
nimble install sections
Example
Following
Section:
var s = ""
s &= "a"
Section:
s &= "b"
Section:
s &= "c"
echo s
Will be converted to
block:
var s = ""
s &= "a"
block:
s &= "b"
echo s
block:
var s = ""
s &= "a"
block:
s &= "c"
echo s
BDD style example
import unittest
import sections
test "For README.md":
Given:
var s:string = ""
s &= "a"
When:
s &= "b"
Then:
echo s
check s=="ab"
When:
s &= "c"
Then:
echo s
check s=="ac"
Tested with
- nim v 0.12
ToDo
- allow optional string argument
- current implementation works only when
Sectionblocks are in direct parent/child structures, deep nesting support is planned in future