commit 449c766e03d94ddf6c823cfcae845f76f83c0e1c
Author: Georg Baum <[email protected]>
Date:   Sun Dec 28 17:34:46 2014 +0100

    Test invalid sanitizeLatexOption() input as well

diff --git a/src/tests/check_ExternalTransforms.cpp 
b/src/tests/check_ExternalTransforms.cpp
index fe7c6f8..aff2369 100644
--- a/src/tests/check_ExternalTransforms.cpp
+++ b/src/tests/check_ExternalTransforms.cpp
@@ -13,7 +13,17 @@ using namespace std;
 void test_sanitizeLatexOption()
 {
        using external::sanitizeLatexOption;
+       // invalid input
+       cout << sanitizeLatexOption("") << endl;
+       cout << sanitizeLatexOption(",") << endl;
+       cout << sanitizeLatexOption(",,") << endl;
+       cout << sanitizeLatexOption("[") << endl;
+       cout << sanitizeLatexOption("]") << endl;
+       // valid input
        cout << sanitizeLatexOption("[]") << endl;
+       cout << sanitizeLatexOption("[[]") << endl;
+       cout << sanitizeLatexOption("[]]") << endl;
+       cout << sanitizeLatexOption("[[]]") << endl;
        cout << sanitizeLatexOption("[,]") << endl;
        cout << sanitizeLatexOption("[,,]") << endl;
        cout << sanitizeLatexOption("[,,,]") << endl;
@@ -32,6 +42,7 @@ void test_sanitizeLatexOption()
 
 int main(int, char **)
 {
-       lyx::lyxerr.setStream(cerr);
+       // Connect lyxerr with cout instead of cerr to catch error output
+       lyx::lyxerr.setStream(cout);
        test_sanitizeLatexOption();
 }
diff --git a/src/tests/regfiles/ExternalTransforms 
b/src/tests/regfiles/ExternalTransforms
index 92a0e56..a53123a 100644
--- a/src/tests/regfiles/ExternalTransforms
+++ b/src/tests/regfiles/ExternalTransforms
@@ -1,4 +1,17 @@
+Unable to sanitize LaTeX "Option": 
 
+Unable to sanitize LaTeX "Option": ,
+
+Unable to sanitize LaTeX "Option": ,,
+
+Unable to sanitize LaTeX "Option": 
+
+Unable to sanitize LaTeX "Option": ]
+
+
+[[]
+[]]
+[[]]
 
 
 

Reply via email to