gitignore bump,

working on maketest
This commit is contained in:
Productive2 2021-01-10 20:03:47 +01:00
parent 2f2180b6e7
commit f6d7d82d62
2 changed files with 13 additions and 6 deletions

3
.gitignore vendored
View File

@ -13,11 +13,14 @@ htmldocs/
src/japl
src/compiler
tests/runtests
tests/maketest
src/lexer
src/vm
tests/runtests
testresults.txt
testoutput.txt
.tempcode.jpl
.tempoutput.txt
# MacOS

View File

@ -18,7 +18,10 @@
# Imports nim tests as well
import multibyte, os, strformat, times, re, terminal
import multibyte, os, strformat, times, re, terminal, strutils
const tempCodeFile = ".tempcode.jpl"
const tempOutputFile = ".tempoutput.txt"
proc autoremove(path: string) =
if fileExists(path):
@ -46,18 +49,19 @@ when isMainModule:
if response =~ re"^file:(.*)$":
codepath = matches[0]
else:
writeFile("tempcode.jpl", response)
writeFile(tempCodeFile, response)
codepath = tempCodeFile
let japlCode = readFile(codepath)
discard execShellCmd(&"{japlExec} {codepath} > testoutput.txt")
let output = readFile("testoutput.txt")
autoremove("tempcode.jpl")
autoremove("testoutput.txt")
let output = readFile(tempOutputFile)
autoremove(tempCodeFile)
autoremove(tempOutputFile)
echo "Got the following output:"
echo output
echo "Do you want to keep it as a test? [y/N]"
let keep = stdin.readChar().toLower() == 'y'
let keep = ($stdin.readChar()).toLower() == "y"
if keep:
block saving:
while true: