Description
Test expected behavior of Command Line Parameters Output, writeOutput and appendOut. Contributor: Lutz Westermann, March 2023
Small Model of Type : GAMS
Category : GAMS Test library
Main file : output01.gms
$title 'Test Output related Command Line Parameters (OUTPUT01,SEQ=935)
$onText
Test expected behavior of Command Line Parameters Output, writeOutput and appendOut.
Contributor: Lutz Westermann, March 2023
$offText
$call.checkErrorLevel rm -rf test.lst test.lxi otherFile.txt
$if exist test.lst $abort WorkDir not clean
$if exist test.lxi $abort WorkDir not clean
$if exist otherFile.txt $abort WorkDir not clean
$echo $log did somthing > test.gms
$call.checkErrorLevel gams test.gms lo=%GAMS.lo%
$if NOT exist test.lst $abort Expect test.lst with default run
$if exist test.lxi $abort Did not expect test.lxi with default run
$call.checkErrorLevel rm -rf test.lst
$if exist test.lst $abort WorkDir not clean
$call.checkErrorLevel gams test.gms IDE=1 lo=%GAMS.lo%
$if NOT exist test.lst $abort Expect test.lst with IDE run
$if NOT exist test.lxi $abort Expect test.lxi with IDE run
$call.checkErrorLevel gams test.gms lo=%GAMS.lo%
$if NOT exist test.lst $abort Expect test.lst with default run
$if exist test.lxi $abort Did not expect test.lxi with default run - even if existed before
$call.checkErrorLevel rm -rf test.lst
$if exist test.lst $abort WorkDir not clean
$call.checkErrorLevel gams test.gms lo=%GAMS.lo% output=otherFile.txt
$if exist test.lst $abort Did not expect test.lst with output=otherFile.txt
$if NOT exist otherFile.txt $abort Expect otherFile.txt with output=otherFile.txt
$call.checkErrorLevel rm -rf otherFile.txt
$if exist otherFile.txt $abort WorkDir not clean
$call.checkErrorLevel gams test.gms lo=%GAMS.lo% writeOutput=0
$if exist test.lst $abort Did not expect test.lst with writeOutput=0
$call.checkErrorLevel gams test.gms lo=%GAMS.lo% writeOutput=0 output=otherFile.txt
$if exist test.lst $abort Did not expect test.lst with writeOutput=0 and output=otherFile.txt
$if exist otherFile.txt $abort Did not expect otherFile.txt with writeOutput=0 and output=otherFile.txt
$call.checkErrorLevel gams test.gms lo=2 appendOut=2 > myStdOut.txt 2> myStdErr.txt
$if exist test.lst $abort Did not expect test.lst with appendOut=2
$call test -s myStdOut.txt
$ifE errorlevel<>0 $abort Did expect myStdOut.txt to be non-empty with appendOut=2
$call test -s myStdErr.txt
$ifE errorlevel=0 $abort Did expect myStdErr.txt to be empty with appendOut=2
$call.checkErrorLevel gams test.gms lo=2 appendOut=3 > myStdOut.txt 2> myStdErr.txt
$if exist test.lst $abort Did not expect test.lst with appendOut=3
$call test -s myStdOut.txt
$ifE errorlevel=0 $abort Did expect myStdOut.txt to be empty with appendOut=3
$call test -s myStdErr.txt
$ifE errorlevel<>0 $abort Did expect myStdErr.txt to be non-empty with appendOut=3