diff options
Diffstat (limited to 'test/w3c/convert-tests.sh')
-rwxr-xr-x | test/w3c/convert-tests.sh | 80 |
1 files changed, 67 insertions, 13 deletions
diff --git a/test/w3c/convert-tests.sh b/test/w3c/convert-tests.sh index f30f8cf..b8deeac 100755 --- a/test/w3c/convert-tests.sh +++ b/test/w3c/convert-tests.sh @@ -8,6 +8,35 @@ ME=`basename $0` DIR="$( cd "$( dirname "$0" )" && pwd )" cd $DIR +while [ "$1" != "" ]; do + case $1 in + ecma ) + ECMA=$1 + shift ;; + lua ) + LUA=$1 + shift ;; + jexl ) + JEXL=$1 + shift ;; + namespace ) + NAMESPACE=$1 + shift ;; + xpath ) + XPATH=$1 + shift ;; + promela ) + PROMELA=$1 + shift ;; + prolog ) + PROLOG=$1 + shift ;; + * ) + echo "unknown datamodel $1" + exit 1 + esac +done + TXMLS=`ls txml/*.txml` TRANSFORM="java -jar /Users/sradomski/Developer/Applications/SaxonHE9-4-0-7J/saxon9he.jar" @@ -16,26 +45,45 @@ for TXML in $TXMLS do echo -n "Processing $TXML for " TARGETFILE=`basename $TXML .txml`.scxml - # echo -n "ecma " && $TRANSFORM $TXML confEcma.xsl -o:ecma/$TARGETFILE - echo -n "namespace " && $TRANSFORM ecma/$TARGETFILE confNamespace.xsl -o:namespace/$TARGETFILE - # echo -n "xpath " && $TRANSFORM $TXML confXPath.xsl -o:xpath/$TARGETFILE - # echo -n "promela " && $TRANSFORM $TXML confPromela.xsl -o:promela/$TARGETFILE - # echo -n "prolog " && $TRANSFORM $TXML confProlog.xsl -o:prolog/$TARGETFILE - # echo -n "lua " && $TRANSFORM $TXML confLua.xsl -o:lua/$TARGETFILE + if [ "$ECMA" != "" ]; then + echo -n "ecma " && $TRANSFORM $TXML confEcma.xsl -o:ecma/$TARGETFILE + fi + if [ "$JEXL" != "" ]; then + echo -n "jexl " && $TRANSFORM $TXML confJEXL.xsl -o:jexl/$TARGETFILE + fi + if [ "$NAMESPACE" != "" ]; then + echo -n "namespace " && $TRANSFORM ecma/$TARGETFILE confNamespace.xsl -o:namespace/$TARGETFILE + fi + if [ "$XPATH" != "" ]; then + echo -n "xpath " && $TRANSFORM $TXML confXPath.xsl -o:xpath/$TARGETFILE + fi + if [ "$PROMELA" != "" ]; then + echo -n "promela " && $TRANSFORM $TXML confPromela.xsl -o:promela/$TARGETFILE + fi + if [ "$PROLOG" != "" ]; then + echo -n "prolog " && $TRANSFORM $TXML confProlog.xsl -o:prolog/$TARGETFILE + fi + if [ "$LUA" != "" ]; then + echo -n "lua " && $TRANSFORM $TXML confLua.xsl -o:lua/$TARGETFILE + fi echo done # make sure substitutions are idempotent! -# percent needs to be escaped in lua patterns -sed -i.orig 's/this%20is%20some%20content/this%%20is%%20some%%20content/g' ./lua/test520.scxml +if [ "$LUA" != "" ]; then + # percent needs to be escaped in lua patterns + sed -i.orig 's/this%20is%20some%20content/this%%20is%%20some%%20content/g' ./lua/test520.scxml -# x-www-form-urlencode will not preserve the type and we default to string -sed -i.orig 's/Var1==2/tonumber(Var1)==2/g' ./lua/test567.scxml + # x-www-form-urlencode will not preserve the type and we default to string + sed -i.orig 's/Var1==2/tonumber(Var1)==2/g' ./lua/test567.scxml +fi -# unnamespace embedded xml in namespace tests -sed -i.orig 's/scxml:book/book/g' ./namespace/test557.scxml -sed -i.orig 's/scxml:book/book/g' ./namespace/test561.scxml +if [ "$NAMESPACE" != "" ]; then + # unnamespace embedded xml in namespace tests + sed -i.orig 's/scxml:book/book/g' ./namespace/test557.scxml + sed -i.orig 's/scxml:book/book/g' ./namespace/test561.scxml +fi cp txml/*.txt ecma/ cp txml/*.txt namespace/ @@ -43,6 +91,7 @@ cp txml/*.txt xpath/ cp txml/*.txt promela/ cp txml/*.txt prolog/ cp txml/*.txt lua/ +cp txml/*.txt jexl/ find ./ecma -type f -exec grep -Ili 'datamodel="xpath"' {} \; |xargs rm -fv find ./namespace -type f -exec grep -Ili 'datamodel="xpath"' {} \; |xargs rm -fv @@ -60,6 +109,10 @@ find ./lua -type f -exec grep -Ili 'datamodel="xpath"' {} \; |xargs rm -fv find ./lua -type f -exec grep -Ili 'datamodel="ecmascript"' {} \; |xargs rm -fv find ./lua -type f -exec grep -Ili 'datamodel="null"' {} \; |xargs rm -fv +find ./jexl -type f -exec grep -Ili 'datamodel="xpath"' {} \; |xargs rm -fv +find ./jexl -type f -exec grep -Ili 'datamodel="ecmascript"' {} \; |xargs rm -fv +find ./jexl -type f -exec grep -Ili 'datamodel="null"' {} \; |xargs rm -fv + # test436 is the null datamodel mv ./ecma/test436.scxml ./null rm ./namespace/test436.scxml @@ -67,6 +120,7 @@ rm ./xpath/test436.scxml rm ./promela/test436.scxml rm ./prolog/test436.scxml rm ./lua/test436.scxml +rm ./jexl/test436.scxml # format all SCXML files SCXMLS=`find . -type f -name '*.scxml'` |