From a9b12c880e4e8955bf337e2445bccad3fcabf31d Mon Sep 17 00:00:00 2001 From: Yousef Almesbahi Date: Sun, 23 Jan 2022 19:11:19 +0800 Subject: [PATCH 1/2] Update unittest.py --- unittest/README.md | 2 ++ unittest/unittest.py | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/unittest/README.md b/unittest/README.md index 430694489..27f8b3a54 100644 --- a/unittest/README.md +++ b/unittest/README.md @@ -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: diff --git a/unittest/unittest.py b/unittest/unittest.py index c78a233a6..3ef0bcce0 100644 --- a/unittest/unittest.py +++ b/unittest/unittest.py @@ -16,6 +16,9 @@ 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)) @@ -182,7 +185,7 @@ def runtest(testlines, args): linenr, lang = alltrees.pop(0).split() if args.verbose: print('---+ line %s (%s), result from GF:' % (linenr, lang)) - for tree in alltrees: + for tree in alltrees: print(' |', tree) if len(alltrees) == 0 or gferror("\n".join(alltrees)): theerror = "\n".join(alltrees) if alltrees else "No parse trees found" @@ -195,7 +198,7 @@ def runtest(testlines, args): if besterrors > 0: for oldlinenr, oldlang, oldtrees in oldresults: if besttree not in oldtrees: - error(linenr, + error(linenr, "The result of line %s (%s):\n %s\n" "is not among the results of line %s (%s):\n %s" % (linenr, lang, besttree, oldlinenr, oldlang, "\n ".join(oldtrees))) From 26d5a9a6023c91dbd59d17b1f1b33e6c9abbc7bd Mon Sep 17 00:00:00 2001 From: Yousef Almesbahi Date: Sun, 23 Jan 2022 20:10:01 +0800 Subject: [PATCH 2/2] Update MorphoAra.gf --- src/arabic/MorphoAra.gf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/arabic/MorphoAra.gf b/src/arabic/MorphoAra.gf index 808223b4d..d3d8e41f7 100644 --- a/src/arabic/MorphoAra.gf +++ b/src/arabic/MorphoAra.gf @@ -1013,7 +1013,7 @@ oper utAbic = "ُ" + tAbic ; utAbac = mkStrong ufAcal tbc ; mutAbac = "م" + utAbac ; - mutAbacAt = mutAbac + "َاَة" + mutAbacAt = mutAbac + "َة" } in verb tAbac twbic utAbic utAbac tAbic mutAbac mutAbacAt ; ----------