mirror of
https://github.com/daylinmorgan/bbansi.git
synced 2024-12-21 18:40:44 -06:00
tests: add integration tests
This commit is contained in:
parent
67e00968fb
commit
eef4d80cfe
3 changed files with 25 additions and 4 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
@ -1,6 +1,6 @@
|
|||
bin/
|
||||
*.out
|
||||
tests/*
|
||||
!tests/*.nims
|
||||
!tests/*.nim
|
||||
|
||||
tests/*
|
||||
!tests/*.nim
|
||||
!tests/*.nims
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
#
|
||||
# To run these tests, simply execute `nimble test`.
|
||||
|
||||
import std/[strutils,unittest]
|
||||
import std/unittest
|
||||
|
||||
import bbansi
|
||||
|
||||
|
|
21
tests/tcli.nim
Normal file
21
tests/tcli.nim
Normal file
|
@ -0,0 +1,21 @@
|
|||
import std/[
|
||||
compilesettings,
|
||||
os,
|
||||
osproc,
|
||||
strutils,
|
||||
unittest
|
||||
]
|
||||
|
||||
const pathToSrc = querySetting(SingleValueSetting.projectPath)
|
||||
|
||||
proc cliRun(cmd: string): string =
|
||||
let (output, _) = execCmdEx(pathToSrc / "bbansi.out " & cmd)
|
||||
return output.strip()
|
||||
|
||||
suite "cli":
|
||||
setup:
|
||||
let cmd = "nim c -o:" & pathToSrc / "bbansi.out " & (pathToSrc / ".." / "src" / "bbansi.nim")
|
||||
check execCmdEx(cmd).exitCode == 0
|
||||
test "simple":
|
||||
check "\e[31mRed\e[0m" == cliRun "[red]Red[/]"
|
||||
check "\e[1m\e[0m\e[1m\e[31mRed\e[0m\e[1m Not Red but Bold\e[0m" == cliRun "'[red]Red[/] Not Red but Bold' " & "--style:bold"
|
Loading…
Reference in a new issue