From ece220418645c11d108b0dd9b100ffe18497296f Mon Sep 17 00:00:00 2001 From: Rico040 <93081680+Rico040@users.noreply.github.com> Date: Tue, 23 Jul 2024 14:19:49 +0800 Subject: [PATCH] tests: runner test --- .gitignore | 6 ++++++ nimhw.nimble | 3 +++ src/nimhw.nim | 4 ++-- tests/basic/tRunner.nim | 21 +++++++++++++++++++++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 tests/basic/tRunner.nim diff --git a/.gitignore b/.gitignore index adb36c8..91004b1 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,7 @@ +nimcache/ +nimblecache/ +htmldocs/ +testresults/ +testresults.html +outputGotten.txt *.exe \ No newline at end of file diff --git a/nimhw.nimble b/nimhw.nimble index dd0813e..f77cf9d 100644 --- a/nimhw.nimble +++ b/nimhw.nimble @@ -11,3 +11,6 @@ bin = @["nimhw"] # Dependencies requires "nim >= 2.0.8" + +task test, "Run all tests": + exec "testament --megatest:off all" diff --git a/src/nimhw.nim b/src/nimhw.nim index 2fef5e6..c0bdccb 100644 --- a/src/nimhw.nim +++ b/src/nimhw.nim @@ -7,7 +7,7 @@ # distribution, for details about the copyright. # import std/[os, parseopt], strutils -import runner, compiler, repl +import nimhw/[runner, compiler, repl] const Usage = """ @@ -58,4 +58,4 @@ if positionalArgs.len > 0 and not compileFlag: # echo "positionalArgs: ", positionalArgs -# echo "code: ", code \ No newline at end of file +# echo "code: ", code diff --git a/tests/basic/tRunner.nim b/tests/basic/tRunner.nim new file mode 100644 index 0000000..cf771d3 --- /dev/null +++ b/tests/basic/tRunner.nim @@ -0,0 +1,21 @@ +discard """ + + output: ''' +Hello! +Hello, Hello! +World! +World, World! +Hello, World! +World, Hello! +quine +''' + +""" +import ../../src/nimhw/runner +echo run("h") +echo run("hh") +echo run("w") +echo run("ww") +echo run("hw") +echo run("wh") +echo run("quine")