From 9b5bc11d60dd6d111661ce4aa37725046071cf6e Mon Sep 17 00:00:00 2001 From: Stefan Radomski Date: Sun, 14 May 2017 14:39:37 +0200 Subject: Passes more tests again --- src/uscxml/Interpreter.cpp | 2 +- src/uscxml/interpreter/BasicContentExecutor.cpp | 11 +++++--- .../plugins/datamodel/promela/PromelaDataModel.cpp | 4 +++ test/issues/test-issue116.scxml | 8 +++--- test/issues/test-issue121.scxml | 13 ++++++++-- test/issues/test-issue127.scxml | 29 ++++++++++++++++++++++ 6 files changed, 56 insertions(+), 11 deletions(-) create mode 100644 test/issues/test-issue127.scxml diff --git a/src/uscxml/Interpreter.cpp b/src/uscxml/Interpreter.cpp index c29c2ec..9390ca4 100644 --- a/src/uscxml/Interpreter.cpp +++ b/src/uscxml/Interpreter.cpp @@ -258,7 +258,7 @@ std::list Interpreter::validate() { static void printNodeSet(Logger& logger, const std::list nodes) { std::string seperator; for (auto nIter = nodes.begin(); nIter != nodes.end(); nIter++) { - LOG(logger, USCXML_VERBATIM) << seperator << (HAS_ATTR(*nIter, kXMLCharId) ? ATTR(*nIter, kXMLCharId) : DOMUtils::xPathForNode(*nIter)) << std::endl; + LOG(logger, USCXML_VERBATIM) << seperator << (HAS_ATTR(*nIter, kXMLCharId) ? ATTR(*nIter, kXMLCharId) : DOMUtils::xPathForNode(*nIter)); seperator = ", "; } } diff --git a/src/uscxml/interpreter/BasicContentExecutor.cpp b/src/uscxml/interpreter/BasicContentExecutor.cpp index 4443237..f3f5376 100644 --- a/src/uscxml/interpreter/BasicContentExecutor.cpp +++ b/src/uscxml/interpreter/BasicContentExecutor.cpp @@ -512,7 +512,7 @@ void BasicContentExecutor::raiseDoneEvent(XERCESC_NS::DOMElement* state, XERCESC try { // namelist processNameLists(doneEvent.namelist, doneData); - } catch (Event e) { + } catch (ErrorEvent e) { ERROR_EXECUTION_RETHROW(e, "Syntax error in donedata element namelist", doneData); } @@ -520,7 +520,7 @@ void BasicContentExecutor::raiseDoneEvent(XERCESC_NS::DOMElement* state, XERCESC try { // params processParams(doneEvent.params, doneData); - } catch (Event e) { + } catch (ErrorEvent e) { ERROR_EXECUTION_RETHROW(e, "Syntax error in donedata element param expr", doneData); } @@ -530,7 +530,7 @@ void BasicContentExecutor::raiseDoneEvent(XERCESC_NS::DOMElement* state, XERCESC if (contents.size() > 0) { doneEvent.data = elementAsData(contents.front()); } - } catch (Event e) { + } catch (ErrorEvent e) { ERROR_EXECUTION_RETHROW(e, "Syntax error in donedata element content", doneData); } @@ -542,7 +542,10 @@ void BasicContentExecutor::raiseDoneEvent(XERCESC_NS::DOMElement* state, XERCESC _callbacks->enqueueInternal(e); // std::cout << exc << std::endl; // throw e; - } + } catch (Event e) { + ERROR_EXECUTION_RETHROW(e, "Error in donedata element", doneData); + } + } _callbacks->enqueueInternal(doneEvent); diff --git a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp b/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp index 048deb5..a764c82 100644 --- a/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp +++ b/src/uscxml/plugins/datamodel/promela/PromelaDataModel.cpp @@ -409,6 +409,10 @@ void PromelaDataModel::setEvent(const Event& event) { case PML_NAME: { Data d = getVariable(node); if (d.atom.size() != 0) + // fixes issue 127 + if (isNumeric(d.atom.c_str(), 10)) { + return Data(d.atom, Data::VERBATIM); + } return Data(d.asJSON(), Data::VERBATIM); if (d.type == Data::INTERPRETED && d.atom[0] == '\'' && d.atom[d.atom.size() - 1] == '\'') return Data(d.atom.substr(1, d.atom.size() - 2), Data::VERBATIM); diff --git a/test/issues/test-issue116.scxml b/test/issues/test-issue116.scxml index 8d1d2b8..b5e618e 100644 --- a/test/issues/test-issue116.scxml +++ b/test/issues/test-issue116.scxml @@ -9,9 +9,9 @@ end - - + + - - + + \ No newline at end of file diff --git a/test/issues/test-issue121.scxml b/test/issues/test-issue121.scxml index d5bf353..aa7fe15 100644 --- a/test/issues/test-issue121.scxml +++ b/test/issues/test-issue121.scxml @@ -1,9 +1,16 @@ - + + + + + + + + @@ -12,10 +19,12 @@ - + + + \ No newline at end of file diff --git a/test/issues/test-issue127.scxml b/test/issues/test-issue127.scxml new file mode 100644 index 0000000..e522f43 --- /dev/null +++ b/test/issues/test-issue127.scxml @@ -0,0 +1,29 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file -- cgit v0.12