forked from glen/fostr
Extraction from streams (#25)
Add the ! postfix operator and !! expression. Also add the ++ string concatenation operator. Also allow specification of standard input in the test scheme. Resolves #7, #18. Co-authored-by: Glen Whitney <glen@studioinfinity.org> Reviewed-on: glen/fostr#25 Co-Authored-By: Glen Whitney <glen@nobody@nowhere.net> Co-Committed-By: Glen Whitney <glen@nobody@nowhere.net>
This commit is contained in:
parent
cc89ad1e93
commit
7feddbcfbe
11 changed files with 106 additions and 11 deletions
|
@ -13,6 +13,9 @@ DESTINATION = 'tests/extracted'
|
|||
# Extension for extracted files:
|
||||
EXT = 'fos'
|
||||
|
||||
# Extension for desired input:
|
||||
INP = 'in'
|
||||
|
||||
# Extension for expectations:
|
||||
EXP = 'expect'
|
||||
|
||||
|
@ -34,6 +37,11 @@ for path in TEST_LIST:
|
|||
expath = destdir / f"{name}.{EXT}"
|
||||
expath.write_text(example)
|
||||
echo Wrote @(expath)
|
||||
im = re.search(r'/\*\*\s+accepts.*?\n([\s\S]*?)\*\*/', details[em.end():])
|
||||
if im:
|
||||
ipath = destdir / f"{name}.{INP}"
|
||||
ipath.write_text(im[1])
|
||||
echo " ...and" @(ipath)
|
||||
xm = re.search(r'/\*\*\s+writes.*?\n([\s\S]*?)\*\*/', details[em.end():])
|
||||
if xm:
|
||||
xpath = destdir / f"{name}.{EXP}"
|
||||
|
|
|
@ -9,8 +9,14 @@ diffed=0
|
|||
for dir in tests/extracted/*; do
|
||||
for file in $dir/*.$ext; do
|
||||
((total++))
|
||||
$command $file > $file.out
|
||||
if [[ $? -ne 0 ]]; then
|
||||
if [[ -f ${file%.*}.in ]]; then
|
||||
cat ${file%.*}.in | $command $file > $file.out
|
||||
result=$?
|
||||
else
|
||||
$command $file > $file.out
|
||||
result=$?
|
||||
fi
|
||||
if [[ $result -ne 0 ]]; then
|
||||
echo ERROR: $command $file failed.
|
||||
((failed++))
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue