hwylterm/tests/tcli.nim

22 lines
608 B
Nim
Raw Normal View History

2024-11-18 08:49:54 -06:00
# TODO: combine this with tests/cli/
2024-09-17 17:28:21 -05:00
import std/[
2024-11-18 08:49:54 -06:00
unittest,
strutils
2024-09-17 17:28:21 -05:00
]
2024-11-14 12:01:56 -06:00
import hwylterm, hwylterm/hwylcli
2024-09-17 17:28:21 -05:00
suite "cli":
2024-09-30 17:23:52 -05:00
test "cli":
let expected = """[b]test-program[/] [[args...]
2024-11-18 08:49:54 -06:00
[bold cyan]flags[/]:
[yellow]-h[/yellow] [magenta]--help [/magenta] []show this help[/]
[yellow]-V[/yellow] [magenta]--version[/magenta] []print version[/]"""
2024-11-14 12:01:56 -06:00
let cli =
newHwylCliHelp(
header = "[b]test-program[/] [[args...]",
flags = [("h","help","show this help",),("V","version","print version")]
)
2024-11-18 08:49:54 -06:00
check render(cli) == expected
check $bb(render(cli)) == $bb(expected)