From 8340e76424717e6b88639b50b9a7d9e569a9b21b Mon Sep 17 00:00:00 2001 From: Daylin Morgan Date: Mon, 27 Jan 2025 12:18:45 -0600 Subject: [PATCH] add compiletime test --- tests/tbbansi.nim | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/tbbansi.nim b/tests/tbbansi.nim index 74d9a89..5ea5845 100644 --- a/tests/tbbansi.nim +++ b/tests/tbbansi.nim @@ -6,6 +6,7 @@ bbMode = On template bbCheck(input: string, output: string): untyped = check escape($bb(input)) == escape(output) + suite "basic": test "simple": bbCheck "[red][/red]", "" @@ -16,6 +17,10 @@ suite "basic": bbCheck "[red]5[/]", "\e[38;5;1m5\e[0m" bbCheck "[bold][red]5","\e[1;38;5;1m5\e[0m" + test "compile time": + const s = bb"[red]red text" + check s == bb"[red]red text" + test "closing": bbCheck "[bold]Bold[red] Bold Red[/red] Bold Only", "\e[1mBold\e[0m\e[1;38;5;1m Bold Red\e[0m\e[1m Bold Only\e[0m" @@ -102,3 +107,4 @@ suite "strutils": check bb"[red]red[/]yellow" == y +