diff options
| -rw-r--r-- | src/tmachines.nim | 14 | ||||
| -rwxr-xr-x | tests/test.sh | 4 |
2 files changed, 10 insertions, 8 deletions
diff --git a/src/tmachines.nim b/src/tmachines.nim index e67f5e3..2d1d190 100644 --- a/src/tmachines.nim +++ b/src/tmachines.nim @@ -1,21 +1,23 @@ -import os +import os, strutils import docopt -import tmachinespkg/tm +from tmachinespkg/tm import nil const tmname {.strdefine.}: string = "" when tmname.len > 0: - const tmd = parse(slurp(tmname & ".tm")) + const tmd = parse(slurp(tmname)) if paramCount() >= 1: - echo makeDTM(tmd, paramStr(1)).test(false) + echo makeDTM(tmd, paramStr(1)).test() else: echo "please specify a single string argument" else: const doc = slurp("../USAGE.txt") let args = docopt(doc) + let file = $args["<machine>"] - let tmd = parse(readFile($args["<machine>"] & ".tm")) - echo makeDTM(tmd, $args["<input>"]).test(not args["--quiet"]) + if file.ends_with(".tm") or file.ends_with(".dtm"): + let tmd = tm.parse(readFile($args["<machine>"])) + echo tm.test(tm.makeDTM(tmd, $args["<input>"]), not args["--quiet"]) diff --git a/tests/test.sh b/tests/test.sh index 2e5e0e4..b16f4fc 100755 --- a/tests/test.sh +++ b/tests/test.sh @@ -7,8 +7,8 @@ for file in `ls -1 $1` ; do if [ -e "$1/$file/testgen.sh" ] ; then "$1/$file/testgen.sh" 50 | while read line ; do split=($line) - echo ./tmachines $1/$file/$file $line - test "./tmachines --quiet $1/$file/$file ${split[0]}" ${split[1]} + echo ./tmachines $1/$file/$file.tm $line + test "./tmachines --quiet $1/$file/$file.tm ${split[0]}" ${split[1]} done fi done |
