From 449c766e03d94ddf6c823cfcae845f76f83c0e1c Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Sun, 28 Dec 2014 17:34:46 +0100 Subject: [PATCH] Test invalid sanitizeLatexOption() input as well --- src/tests/check_ExternalTransforms.cpp | 13 ++++++++++++- src/tests/regfiles/ExternalTransforms | 13 +++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/src/tests/check_ExternalTransforms.cpp b/src/tests/check_ExternalTransforms.cpp index fe7c6f8569..aff2369a93 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 92a0e56328..a53123a6c3 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": ] + + +[[] +[]] +[[]]