mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-03 08:28:25 +00:00
Add unit test for sanitizeLatexOption()
This is a prerequisite for safe removal of regex::match_partial.
This commit is contained in:
parent
59ab49846a
commit
1db9224cff
@ -681,8 +681,12 @@ endif
|
||||
############################## Tests ##################################
|
||||
|
||||
EXTRA_DIST += \
|
||||
tests/test_ExternalTransforms \
|
||||
tests/regfiles/ExternalTransforms \
|
||||
tests/test_layout
|
||||
|
||||
TESTS = tests/test_ExternalTransforms
|
||||
|
||||
alltests: check alltests-recursive
|
||||
|
||||
alltests-recursive: check_layout
|
||||
@ -698,6 +702,7 @@ updatetests:
|
||||
cd tex2lyx; $(MAKE) updatetests
|
||||
|
||||
check_PROGRAMS = \
|
||||
check_ExternalTransforms \
|
||||
check_layout
|
||||
|
||||
if INSTALL_MACOSX
|
||||
@ -724,4 +729,16 @@ check_layout_SOURCES = \
|
||||
tests/boost.cpp \
|
||||
tests/dummy_functions.cpp
|
||||
|
||||
check_ExternalTransforms_CPPFLAGS = $(AM_CPPFLAGS)
|
||||
check_ExternalTransforms_LDADD = support/liblyxsupport.a $(LIBICONV) $(BOOST_LIBS) @LIBS@ $(QT_CORE_LIBS) $(LIBSHLWAPI)
|
||||
check_ExternalTransforms_LDFLAGS = $(QT_CORE_LDFLAGS) $(ADD_FRAMEWORKS)
|
||||
check_ExternalTransforms_SOURCES = \
|
||||
graphics/GraphicsParams.cpp \
|
||||
insets/ExternalTransforms.cpp \
|
||||
Length.cpp \
|
||||
lengthcommon.cpp \
|
||||
tests/check_ExternalTransforms.cpp \
|
||||
tests/boost.cpp \
|
||||
tests/dummy_functions.cpp
|
||||
|
||||
.PHONY: alltests alltests-recursive updatetests
|
||||
|
37
src/tests/check_ExternalTransforms.cpp
Normal file
37
src/tests/check_ExternalTransforms.cpp
Normal file
@ -0,0 +1,37 @@
|
||||
#include <config.h>
|
||||
|
||||
#include "../insets/ExternalTransforms.h"
|
||||
#include "../support/debug.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
|
||||
using namespace lyx;
|
||||
using namespace std;
|
||||
|
||||
|
||||
void test_sanitizeLatexOption()
|
||||
{
|
||||
using external::sanitizeLatexOption;
|
||||
cout << sanitizeLatexOption("[]") << endl;
|
||||
cout << sanitizeLatexOption("[,]") << endl;
|
||||
cout << sanitizeLatexOption("[,,]") << endl;
|
||||
cout << sanitizeLatexOption("[,,,]") << endl;
|
||||
cout << sanitizeLatexOption("[a]") << endl;
|
||||
cout << sanitizeLatexOption("[,a]") << endl;
|
||||
cout << sanitizeLatexOption("[,,a]") << endl;
|
||||
cout << sanitizeLatexOption("[,,,a]") << endl;
|
||||
cout << sanitizeLatexOption("[a,b]") << endl;
|
||||
cout << sanitizeLatexOption("[a,,b]") << endl;
|
||||
cout << sanitizeLatexOption("[a,,,b]") << endl;
|
||||
cout << sanitizeLatexOption("[a,]") << endl;
|
||||
cout << sanitizeLatexOption("[a,,]") << endl;
|
||||
cout << sanitizeLatexOption("[a,,,]") << endl;
|
||||
}
|
||||
|
||||
|
||||
int main(int, char **)
|
||||
{
|
||||
lyx::lyxerr.setStream(cerr);
|
||||
test_sanitizeLatexOption();
|
||||
}
|
14
src/tests/regfiles/ExternalTransforms
Normal file
14
src/tests/regfiles/ExternalTransforms
Normal file
@ -0,0 +1,14 @@
|
||||
|
||||
|
||||
|
||||
|
||||
[a]
|
||||
[a]
|
||||
[a]
|
||||
[a]
|
||||
[a,b]
|
||||
[a,b]
|
||||
[a,b]
|
||||
[a]
|
||||
[a]
|
||||
[a]
|
7
src/tests/test_ExternalTransforms
Executable file
7
src/tests/test_ExternalTransforms
Executable file
@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
regfile=`cat ${srcdir}/tests/regfiles/ExternalTransforms`
|
||||
output=`./check_ExternalTransforms`
|
||||
|
||||
test "$regfile" = "$output"
|
||||
exit $?
|
Loading…
Reference in New Issue
Block a user