Description
Tests the correct fucntionality of nested blocks with the use of tags. Contributor: Lutz Westermann, March 2022
Small Model of Type : GAMS
Category : GAMS Test library
Main file : nestblock01.gms
$title Test the use of nested blocks (NESTBLOCK01,SEQ=901)
$onText
Tests the correct fucntionality of nested blocks with the use of tags.
Contributor: Lutz Westermann, March 2022
$offText
$onEcho.a1 > nestedEcho1.gms
$log I am nestedEcho1.gms
$onEcho.a2 > nestedEcho2.gms
$log I am nestedEcho2.gms
$offEcho.a2
$offEcho.a1
$include nestedEcho1.gms
$onEcho > nestedEcho1Want.gms
$log I am nestedEcho1.gms
$onEcho.a2 > nestedEcho2.gms
$log I am nestedEcho2.gms
$offEcho.a2
$offEcho
$onEcho > nestedEcho2Want.gms
$log I am nestedEcho2.gms
$offEcho
$call.checkErrorLevel diff nestedEcho1.gms nestedEcho1Want.gms > %system.nullFile%
$call.checkErrorLevel diff nestedEcho2.gms nestedEcho2Want.gms > %system.nullFile%
file fx / 'nestedPut1.gms' /; put fx;
$onPut.a1
file fy / 'nestedPut2.gms' /; put fy;
$onPut.a2
display 'inside';
$offPut.a2
putclose;
display 'outside';
$offPut.a1
putclose;
execute.checkErrorLevel 'gams nestedPut1.gms lo=%GAMS.lo%';
$onEcho > nestedPut1Want.gms
file fy / 'nestedPut2.gms' /; put fy;
$onPut.a2
display 'inside';
$offPut.a2
putclose;
display 'outside';
$offEcho
$onEcho > nestedPut2Want.gms
display 'inside';
$offEcho
execute.checkErrorLevel 'diff nestedPut1.gms nestedPut1Want.gms > %system.nullFile%';
execute.checkErrorLevel 'diff nestedPut2.gms nestedPut2Want.gms > %system.nullFile%';
* The following tests are expected to fail
$onEcho > failTest.gms
file fx; put fx;
$onPut.unmatchedTag > willNotWork.txt
NONE
$offPut
$offEcho
$call gams failTest.gms lo=%GAMS.lo%
$ifE errorLevel=0 $abort Errors expected
$onEcho > failTest.gms
file fx; put fx;
$onPut > willNotWork.txt
NONE
$offPut.unmatchedTag
$offEcho
$call gams failTest.gms lo=%GAMS.lo%
$ifE errorLevel=0 $abort Errors expected
$onEcho > failTest.gms
file fx; put fx;
$onPut.unmatchedTag1 > willNotWork.txt
NONE
$offPut.unmatchedTag2
$offEcho
$call gams failTest.gms lo=%GAMS.lo%
$ifE errorLevel=0 $abort Errors expected