added test for multidimensional for loop

master
Marc Wäckerlin 9 years ago
parent 9fad6a0397
commit 7ad5b32893
  1. 5
      bootstrap.sh
  2. 10
      examples/test-commands.wt
  3. 9
      src/commands.hxx

@ -698,11 +698,12 @@ if testtag AX_USE_DEBIAN_PACKAGING; then
-- @AUTHOR@ @BUILD_DATE@ -- @AUTHOR@ @BUILD_DATE@
EOF EOF
BUILD_DEPENDS="debhelper, subversion, pkg-config, autotools-dev, lsb-release $(if testtag AX_USE_DOXYGEN; then echo -n ", doxygen, graphviz, mscgen"; fi; if testtag AX_USE_CPPUNIT; then echo -n ", libcppunit-dev"; fi; if testtag AX_CXX_QT || testtag AX_CHECK_QT AX_REQUIRE_QT; then echo -n ", qt5-default | qt4-default | qt5-qmake | qt4-qmake, qtbase5-dev | libqt4-dev, qtbase5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools"; fi)"
to debian/control.in <<EOF to debian/control.in <<EOF
Source: @PACKAGE_NAME@ Source: @PACKAGE_NAME@
Priority: extra Priority: extra
Maintainer: @AUTHOR@ Maintainer: @AUTHOR@
Build-Depends: debhelper, subversion, pkg-config, autotools-dev, lsb-release $(if testtag AX_USE_DOXYGEN; then echo -n ", doxygen, graphviz, mscgen"; fi; if testtag AX_USE_CPPUNIT; then echo -n ", libcppunit-dev"; fi; if testtag AX_CXX_QT || testtag AX_CHECK_QT AX_REQUIRE_QT; then echo -n ", qt5-default | qt4-default | qt5-qmake | qt4-qmake, qtbase5-dev | libqt4-dev, qtbase5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools, qttools5-dev-tools | qt4-dev-tools"; fi) Build-Depends: ${BUILD-DEPENDS}
Package: @PACKAGE_NAME@ Package: @PACKAGE_NAME@
Section: $(if testtag AX_USE_LIBTOOL; then echo "libs"; fi) Section: $(if testtag AX_USE_LIBTOOL; then echo "libs"; fi)
@ -716,7 +717,7 @@ $( if testtag AX_USE_LIBTOOL; then
Package: @PACKAGE_NAME@-dev Package: @PACKAGE_NAME@-dev
Section: libdevel Section: libdevel
Architecture: any Architecture: any
Depends: @PACKAGE_NAME@ (= \${binary:Version}) Depends: @PACKAGE_NAME@ (= \${binary:Version}), ${BUILD-DEPENDS}
Description: @DESCRIPTION@ - Development Package Description: @DESCRIPTION@ - Development Package
@README_DEB@ @README_DEB@
EOF2 EOF2

@ -87,3 +87,13 @@ set RESULT
cat testfile cat testfile
rm testfile rm testfile
check RESULT = -5;-6;-7;-8;-9; check RESULT = -5;-6;-7;-8;-9;
# multi dimensional for loops
# VAR colides with VARS1 and VARS2
unset VAR
set VARS1 = 1, 2, 3, 4
set VARS2 = a, b, c, d
set RESULT =
for VARS1
for VARS2
set RESULT = RESULTVARS1.VARS2;
check RESULT = 1.a;1.b;1.c;1.d;2.a;2.b;2.c;2.d;3.a;3.b;3.c;3.d;4.a;4.b;4.c;4.d;

@ -762,6 +762,9 @@ class Script: public QObject {
_variables[name] = value; _variables[name] = value;
_rvariables[value] = name; _rvariables[value] = name;
} }
QStringList variables() {
return _variables.keys();
}
QString variable(QString name) { QString variable(QString name) {
QMap<QString, QString>::iterator it(_variables.find(name)); QMap<QString, QString>::iterator it(_variables.find(name));
if (it==_variables.end()) throw VariableNotFound(name); if (it==_variables.end()) throw VariableNotFound(name);
@ -1675,11 +1678,11 @@ class Set: public Command {
Logger log(this, script); Logger log(this, script);
if (_next) { if (_next) {
_next->execute(script, frame); _next->execute(script, frame);
script->set(script->replacevars(_name), script->set(_name,
script->replacevars(_next->result())); script->replacevars(_next->result()));
log(_name+"='"+_next->result().replace("\\", "\\\\").replace("'", "\\'")+"'"); log(_name+"='"+_next->result().replace("\\", "\\\\").replace("'", "\\'")+"'");
} else { } else {
script->set(script->replacevars(_name), script->set(_name,
script->replacevars(_value)); script->replacevars(_value));
log(_name+"='"+_value.replace("\\", "\\\\").replace("'", "\\'")+"'"); log(_name+"='"+_value.replace("\\", "\\\\").replace("'", "\\'")+"'");
} }
@ -2414,6 +2417,8 @@ inline bool Command::runScript(Command* parentCommand,
disconnect(&scriptCopy, SIGNAL(logging(QString)), disconnect(&scriptCopy, SIGNAL(logging(QString)),
parent, SLOT(parentlog(QString))); parent, SLOT(parentlog(QString)));
parentCommand->_result = scriptCopy.result(); parentCommand->_result = scriptCopy.result();
Q_FOREACH(QString key, scriptCopy.variables())
if (!vars.contains(key)) parent->set(key, scriptCopy.variable(key));
if (parentCommand->_result.size()) if (parentCommand->_result.size())
parent->log("result: "+parentCommand->_result); parent->log("result: "+parentCommand->_result);
return res; return res;

Loading…
Cancel
Save