summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <[email protected]>2017-05-14 16:53:41 +0200
committerMontel Laurent <[email protected]>2017-05-14 16:53:41 +0200
commitc5dd5bf254178237d8e716517fb811d1316abdbe (patch)
treea97ce4697e8c7fda0b62a52ca26db2ab4c0b29f1
parent11dadb916ab93c335b6cb566505a57a78cce767c (diff)
Add regexp test which failed
-rw-r--r--src/ksieveui/autocreatescripts/autotests/data/regexp-ref.siv14
-rw-r--r--src/ksieveui/autocreatescripts/autotests/data/regexp.siv14
-rw-r--r--src/ksieveui/autocreatescripts/autotests/sieveeditorgraphicalmodewidgettest.cpp3
-rw-r--r--src/ksieveui/autocreatescripts/sieveconditionwidgetlister.cpp3
4 files changed, 34 insertions, 0 deletions
diff --git a/src/ksieveui/autocreatescripts/autotests/data/regexp-ref.siv b/src/ksieveui/autocreatescripts/autotests/data/regexp-ref.siv
new file mode 100644
index 0000000..ebff029
--- /dev/null
+++ b/src/ksieveui/autocreatescripts/autotests/data/regexp-ref.siv
@@ -0,0 +1,14 @@
+require "regex";
+
+ # Try to catch unsolicited email.
+ if anyof (
+ # if a message is not to me (with optional +detail),
+ not address :regex ["to", "cc", "bcc"]
+ "me(\\\\+.*)[email protected]\\\\.com",
+
+ # or the subject is all uppercase (no lowercase)
+ header :regex :comparator "i;octet" "subject"
+ "^[^[:lower:]]+$" ) {
+
+ discard; # junk it
+ }
diff --git a/src/ksieveui/autocreatescripts/autotests/data/regexp.siv b/src/ksieveui/autocreatescripts/autotests/data/regexp.siv
new file mode 100644
index 0000000..ebff029
--- /dev/null
+++ b/src/ksieveui/autocreatescripts/autotests/data/regexp.siv
@@ -0,0 +1,14 @@
+require "regex";
+
+ # Try to catch unsolicited email.
+ if anyof (
+ # if a message is not to me (with optional +detail),
+ not address :regex ["to", "cc", "bcc"]
+ "me(\\\\+.*)[email protected]\\\\.com",
+
+ # or the subject is all uppercase (no lowercase)
+ header :regex :comparator "i;octet" "subject"
+ "^[^[:lower:]]+$" ) {
+
+ discard; # junk it
+ }
diff --git a/src/ksieveui/autocreatescripts/autotests/sieveeditorgraphicalmodewidgettest.cpp b/src/ksieveui/autocreatescripts/autotests/sieveeditorgraphicalmodewidgettest.cpp
index 976a696..a7187cb 100644
--- a/src/ksieveui/autocreatescripts/autotests/sieveeditorgraphicalmodewidgettest.cpp
+++ b/src/ksieveui/autocreatescripts/autotests/sieveeditorgraphicalmodewidgettest.cpp
@@ -91,6 +91,7 @@ void SieveEditorGraphicalModeWidgetTest::shouldLoadScripts()
proc.start(QStringLiteral("diff"), args);
QVERIFY(proc.waitForFinished());
+ QEXPECT_FAIL("regexp" , "Expected failure on regexp file. Problem with header + comparator", Continue);
QEXPECT_FAIL("test-current-date" , "Expected failure on delete-headers file", Continue);
QCOMPARE(proc.exitCode(), 0);
}
@@ -152,6 +153,8 @@ void SieveEditorGraphicalModeWidgetTest::shouldLoadScripts_data()
QTest::newRow("vacation-active-discard") << QStringLiteral("vacation-active-discard") << false << true;
QTest::newRow("vacation-multiple") << QStringLiteral("vacation-multiple") << false << true;
QTest::newRow("full-example1") << QStringLiteral("full-example1") << false << true;
+ //We need to fix it.
+ QTest::newRow("regexp") << QStringLiteral("regexp") << true << true;
}
diff --git a/src/ksieveui/autocreatescripts/sieveconditionwidgetlister.cpp b/src/ksieveui/autocreatescripts/sieveconditionwidgetlister.cpp
index c7225d2..85c0dc1 100644
--- a/src/ksieveui/autocreatescripts/sieveconditionwidgetlister.cpp
+++ b/src/ksieveui/autocreatescripts/sieveconditionwidgetlister.cpp
@@ -367,6 +367,9 @@ void SieveConditionWidgetLister::loadScript(const QDomElement &e, bool uniqTest,
}
} else if (testTagName == QLatin1String("crlf")) {
//nothing
+ } else if (testTagName == QLatin1String("comment")) {
+ //nothing
+ //implement in the future ?
} else {
qCDebug(LIBKSIEVE_LOG) << " SieveConditionWidgetLister::loadScript unknown condition tag: " << testTagName;
}