regression tests for fixed crash
authorkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Fri, 10 Dec 2010 21:32:48 +0000 (21:32 +0000)
committerkonrad <konrad@6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33>
Fri, 10 Dec 2010 21:32:48 +0000 (21:32 +0000)
git-svn-id: https://silmor.de/svn/softmagic/elam/trunk@654 6e3c4bff-ac9f-4ac1-96c5-d2ea494d3e33

tests/eval/eval.cpp
tests/eval/eval.h
tests/parser/parser.cpp
tests/parser/parser.h

index abf866c..da3adaf 100644 (file)
@@ -9,6 +9,12 @@
 using namespace ELAM;
 
 
+void ElamTest::emptytest()
+{
+       QVariant v=Engine().evaluate("");
+       QCOMPARE(v.userType(),Exception::metaTypeId());
+}
+
 void ElamTest::evaltest()
 {
        IntEngine ie;
index 11986f6..ef4409c 100644 (file)
@@ -4,6 +4,7 @@ class ElamTest:public QObject
 {
        Q_OBJECT
        private slots:
+               void emptytest();
                void evaltest();
                void excepttest();
                void counttest();
index fef435b..449b31b 100644 (file)
@@ -114,5 +114,13 @@ void ElamTest::stringLiteral()
        QCOMPARE(v2.toString(),QString("abc12"));
 }
 
+void ElamTest::emptyList()
+{
+       IntEngine ie;
+       QList<Token>tl=ie.tokenize("");
+       QCOMPARE(tl.size(),0);
+       tl=ie.tokenize(" \t\n");
+       QCOMPARE(tl.size(),0);
+}
 
 QTEST_MAIN(ElamTest)
\ No newline at end of file
index ca5571d..215de9d 100644 (file)
@@ -7,4 +7,5 @@ class ElamTest:public QObject
                void charClass();
                void tokenizer();
                void stringLiteral();
+               void emptyList();
 };