Update unittest.py

This commit is contained in:
Yousef Almesbahi
2022-01-23 19:11:19 +08:00
committed by Meowyam
parent d021ebd527
commit 45d47afc36
2 changed files with 8 additions and 3 deletions

View File

@@ -9,6 +9,8 @@ python path/to/unittest.py [-h] [-v] [--no-pmcfg] path/to/testfile.gftest (...)
The script must be located in a sibling directory
to the RGL `src` directory to work properly.
**Note:** On Windows use WSL (Windows Subsystem for Linux) to run `unittest.py` script, also replace the commented lines for Windows inside the script.
## Test format
The test file should look something like this:

View File

@@ -16,6 +16,9 @@ import argparse
from subprocess import Popen, PIPE
from glob import glob
GF_PROCESS = 'gf -run'
## For WSL on windows replace the GF_PROCESS with following line
##GF_PROCESS = 'gf.exe -run'
GRAMMARDIR = '../src'
ENCODING = 'utf-8'
@@ -161,7 +164,7 @@ def runtest(testlines, args):
print()
# calling GF from a subprocess:
command = 'gf -run'.split()
command = GF_PROCESS.split()
gfinput = '\n'.join(gfscript) + '\n'
gf = Popen(command, stdin=PIPE, stdout=PIPE)
stdout, _stderr = gf.communicate(gfinput.encode(ENCODING))