aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDominik Haumann <dhaumann@kde.org>2013-11-09 16:34:01 (GMT)
committerDominik Haumann <dhaumann@kde.org>2013-11-09 16:34:01 (GMT)
commit50c4c57923c9daeea0d3c4925685599e4e474ccf (patch)
treeb98a0864d7305dcd2e4a48ea273fb6c998b202de
parent106f1bd5a83db44d463aca55bfdbf0fe568ef4c1 (diff)
add unit test suite for LaTeX indenter
Contributions to improve this indenter along with additional test cases are very much welcome! Are there any other test cases that should be added right now? CCMAIL: j.b.p.vuurens@tudelft.nl CCMAIL: kile-devel@lists.sourceforge.net
-rw-r--r--tests/data/indent/latex/.kateconfig2
-rw-r--r--tests/data/indent/latex/env1/expected2
-rw-r--r--tests/data/indent/latex/env1/input.js3
-rw-r--r--tests/data/indent/latex/env1/origin1
-rw-r--r--tests/data/indent/latex/env2/expected2
-rw-r--r--tests/data/indent/latex/env2/input.js2
-rw-r--r--tests/data/indent/latex/env2/origin2
-rw-r--r--tests/data/indent/latex/env3/expected4
-rw-r--r--tests/data/indent/latex/env3/input.js7
-rw-r--r--tests/data/indent/latex/env3/origin1
-rw-r--r--tests/indenttest.cpp11
-rw-r--r--tests/indenttest.h3
12 files changed, 40 insertions, 0 deletions
diff --git a/tests/data/indent/latex/.kateconfig b/tests/data/indent/latex/.kateconfig
new file mode 100644
index 0000000..246af21
--- /dev/null
+++ b/tests/data/indent/latex/.kateconfig
@@ -0,0 +1,2 @@
+kate: replace-tabs on; remove-trailing-spaces all;
+kate: hl latex; indent-mode latex; indent-width 2;
diff --git a/tests/data/indent/latex/env1/expected b/tests/data/indent/latex/env1/expected
new file mode 100644
index 0000000..64b7519
--- /dev/null
+++ b/tests/data/indent/latex/env1/expected
@@ -0,0 +1,2 @@
+\begin{foo}
+ a \ No newline at end of file
diff --git a/tests/data/indent/latex/env1/input.js b/tests/data/indent/latex/env1/input.js
new file mode 100644
index 0000000..61d3c9a
--- /dev/null
+++ b/tests/data/indent/latex/env1/input.js
@@ -0,0 +1,3 @@
+v.setCursorPosition(0, d.lineLength(0));
+v.enter();
+v.type("a");
diff --git a/tests/data/indent/latex/env1/origin b/tests/data/indent/latex/env1/origin
new file mode 100644
index 0000000..98df0e1
--- /dev/null
+++ b/tests/data/indent/latex/env1/origin
@@ -0,0 +1 @@
+\begin{foo} \ No newline at end of file
diff --git a/tests/data/indent/latex/env2/expected b/tests/data/indent/latex/env2/expected
new file mode 100644
index 0000000..16b21d5
--- /dev/null
+++ b/tests/data/indent/latex/env2/expected
@@ -0,0 +1,2 @@
+\begin{foo}
+\end{foo} \ No newline at end of file
diff --git a/tests/data/indent/latex/env2/input.js b/tests/data/indent/latex/env2/input.js
new file mode 100644
index 0000000..2e82141
--- /dev/null
+++ b/tests/data/indent/latex/env2/input.js
@@ -0,0 +1,2 @@
+v.setCursorPosition(1, d.lineLength(1));
+v.type("{foo}");
diff --git a/tests/data/indent/latex/env2/origin b/tests/data/indent/latex/env2/origin
new file mode 100644
index 0000000..253f20b
--- /dev/null
+++ b/tests/data/indent/latex/env2/origin
@@ -0,0 +1,2 @@
+\begin{foo}
+ \end \ No newline at end of file
diff --git a/tests/data/indent/latex/env3/expected b/tests/data/indent/latex/env3/expected
new file mode 100644
index 0000000..4b61f7d
--- /dev/null
+++ b/tests/data/indent/latex/env3/expected
@@ -0,0 +1,4 @@
+\begin{foo}
+ \begin{bar}
+ \end{bar}
+\end{foo} \ No newline at end of file
diff --git a/tests/data/indent/latex/env3/input.js b/tests/data/indent/latex/env3/input.js
new file mode 100644
index 0000000..601bc47
--- /dev/null
+++ b/tests/data/indent/latex/env3/input.js
@@ -0,0 +1,7 @@
+v.setCursorPosition(0, d.lineLength(0));
+v.enter();
+v.type("\\begin{bar}");
+v.enter();
+v.type("\\end{bar}");
+v.enter();
+v.type("\\end{foo}");
diff --git a/tests/data/indent/latex/env3/origin b/tests/data/indent/latex/env3/origin
new file mode 100644
index 0000000..98df0e1
--- /dev/null
+++ b/tests/data/indent/latex/env3/origin
@@ -0,0 +1 @@
+\begin{foo} \ No newline at end of file
diff --git a/tests/indenttest.cpp b/tests/indenttest.cpp
index 95d976b..9222c6d 100644
--- a/tests/indenttest.cpp
+++ b/tests/indenttest.cpp
@@ -153,6 +153,17 @@ void IndentTest::haskell()
}
+void IndentTest::latex_data()
+{
+ getTestData( "latex" );
+}
+
+void IndentTest::latex()
+{
+ runTest( ExpectedFailures() );
+}
+
+
void IndentTest::pascal_data()
{
getTestData( "pascal" );
diff --git a/tests/indenttest.h b/tests/indenttest.h
index ae17b5f..bb93fc4 100644
--- a/tests/indenttest.h
+++ b/tests/indenttest.h
@@ -42,6 +42,9 @@ private slots:
void haskell_data();
void haskell();
+ void latex_data();
+ void latex();
+
void pascal_data();
void pascal();