Updated tests for tight/loose lists.

Taking into account new context/latex output, and fixing
some bugs in the test suite Tests.Helpers and Tests.Writers.ConTeXt.
(We had the wrong order of expected/actual in the diff output.)
This commit is contained in:
John MacFarlane 2013-01-07 20:58:12 -08:00
parent 1a9193c30d
commit 8ff81dc9ca
4 changed files with 67 additions and 37 deletions

View file

@ -62,8 +62,8 @@ test fn name (input, expected) =
actual' = toString $ fn input
expected' = toString expected
diff = getDiff (lines expected') (lines actual')
expected'' = unlines $ map vividize [Second x | Second x <- diff]
actual'' = unlines $ map vividize [First x | First x <- diff]
expected'' = unlines $ map vividize [First x | First x <- diff]
actual'' = unlines $ map vividize [Second x | Second x <- diff]
dashes "" = replicate 72 '-'
dashes x = replicate (72 - length x - 5) '-' ++ " " ++ x ++ " ---"

View file

@ -46,19 +46,20 @@ tests = [ testGroup "inline code"
]
, testGroup "bullet lists"
[ "nested" =:
bulletList [plain (text "top")
,bulletList [plain (text "next")
,bulletList [plain (text "bot")]]]
=?> [_LIT|
\startitemize
bulletList [
plain (text "top")
<> bulletList [
plain (text "next")
<> bulletList [plain (text "bot")]
]
] =?> [_LIT|
\startitemize[packed]
\item
top
\item
\startitemize
\startitemize[packed]
\item
next
\item
\startitemize
\startitemize[packed]
\item
bot
\stopitemize

View file

@ -115,7 +115,7 @@ sub status {
A list:
\startitemize[n][stopper=.]
\startitemize[n,packed][stopper=.]
\item
item one
\item
@ -169,7 +169,7 @@ These should not be escaped: \$ \\ \> \[ \{
Asterisks tight:
\startitemize
\startitemize[packed]
\item
asterisk 1
\item
@ -191,7 +191,7 @@ Asterisks loose:
Pluses tight:
\startitemize
\startitemize[packed]
\item
Plus 1
\item
@ -213,7 +213,7 @@ Pluses loose:
Minuses tight:
\startitemize
\startitemize[packed]
\item
Minus 1
\item
@ -237,7 +237,7 @@ Minuses loose:
Tight:
\startitemize[n][stopper=.]
\startitemize[n,packed][stopper=.]
\item
First
\item
@ -248,7 +248,7 @@ Tight:
and:
\startitemize[n][stopper=.]
\startitemize[n,packed][stopper=.]
\item
One
\item
@ -294,13 +294,13 @@ Multiple paragraphs:
\subsection[nested]{Nested}
\startitemize
\startitemize[packed]
\item
Tab
\startitemize
\startitemize[packed]
\item
Tab
\startitemize
\startitemize[packed]
\item
Tab
\stopitemize
@ -309,12 +309,12 @@ Multiple paragraphs:
Here's another:
\startitemize[n][stopper=.]
\startitemize[n,packed][stopper=.]
\item
First
\item
Second:
\startitemize
\startitemize[packed]
\item
Fee
\item
@ -334,7 +334,7 @@ Same thing but with paragraphs:
\item
Second:
\startitemize
\startitemize[packed]
\item
Fee
\item
@ -372,12 +372,12 @@ Same thing but with paragraphs:
with a continuation
\startitemize[r][start=4,stopper=.,width=2.0em]
\startitemize[r,packed][start=4,stopper=.,width=2.0em]
\item
sublist with roman numerals, starting with 4
\item
more items
\startitemize[A][left=(,stopper=),width=2.0em]
\startitemize[A,packed][left=(,stopper=),width=2.0em]
\item
a subsublist
\item
@ -388,16 +388,16 @@ Same thing but with paragraphs:
Nesting:
\startitemize[A][stopper=.]
\startitemize[A,packed][stopper=.]
\item
Upper Alpha
\startitemize[R][stopper=.]
\startitemize[R,packed][stopper=.]
\item
Upper Roman.
\startitemize[n][start=6,left=(,stopper=),width=2.0em]
\startitemize[n,packed][start=6,left=(,stopper=),width=2.0em]
\item
Decimal start with 6
\startitemize[a][start=3,stopper=)]
\startitemize[a,packed][start=3,stopper=)]
\item
Lower alpha with paren
\stopitemize
@ -407,12 +407,12 @@ Nesting:
Autonumbering:
\startitemize[n]
\startitemize[n,packed]
\item
Autonumber.
\item
More.
\startitemize[a]
\startitemize[a,packed]
\item
Nested.
\stopitemize
@ -529,7 +529,7 @@ Blank line after term, indented marker, alternate markers:
\startdescription{orange}
orange fruit
\startitemize[n][stopper=.]
\startitemize[n,packed][stopper=.]
\item
sublist
\item
@ -646,7 +646,7 @@ Ellipses\ldots{}and\ldots{}and\ldots{}.
\section[latex]{LaTeX}
\startitemize
\startitemize[packed]
\item
\cite[22-23]{smith.1899}
\item
@ -668,7 +668,7 @@ Ellipses\ldots{}and\ldots{}and\ldots{}.
These shouldn't be math:
\startitemize
\startitemize[packed]
\item
To get the famous equation, write \type{$e = mc^2$}.
\item
@ -688,7 +688,7 @@ Here's a LaTeX table:
Here is some unicode:
\startitemize
\startitemize[packed]
\item
I hat: Î
\item
@ -813,7 +813,7 @@ braces]\from[url26].
With an ampersand:
\useURL[url27][http://example.com/?foo=1&bar=2][][\hyphenatedurl{http://example.com/?foo=1&bar=2}]\from[url27]
\startitemize
\startitemize[packed]
\item
In a list?
\item
@ -873,7 +873,7 @@ note{]} Here is an inline note.\footnote{This is {\em easier} to type. Inline
Notes can go in quotes.\footnote{In quote.}
\stopblockquote
\startitemize[n][stopper=.]
\startitemize[n,packed][stopper=.]
\item
And in list items.\footnote{In list.}
\stopitemize

View file

@ -122,6 +122,7 @@ A list:
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\itemsep1pt\parskip0pt\parsep0pt
\item
item one
\item
@ -176,6 +177,7 @@ These should not be escaped: \$ \\ \> \[ \{
Asterisks tight:
\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
asterisk 1
\item
@ -198,6 +200,7 @@ Asterisks loose:
Pluses tight:
\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
Plus 1
\item
@ -220,6 +223,7 @@ Pluses loose:
Minuses tight:
\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
Minus 1
\item
@ -245,6 +249,7 @@ Tight:
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\itemsep1pt\parskip0pt\parsep0pt
\item
First
\item
@ -257,6 +262,7 @@ and:
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\itemsep1pt\parskip0pt\parsep0pt
\item
One
\item
@ -306,14 +312,17 @@ Multiple paragraphs:
\subsection{Nested}
\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
Tab
\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
Tab
\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
Tab
\end{itemize}
@ -324,12 +333,14 @@ Here's another:
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\itemsep1pt\parskip0pt\parsep0pt
\item
First
\item
Second:
\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
Fee
\item
@ -351,6 +362,7 @@ Same thing but with paragraphs:
Second:
\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
Fee
\item
@ -393,6 +405,7 @@ Same thing but with paragraphs:
\begin{enumerate}
\def\labelenumii{\roman{enumii}.}
\setcounter{enumii}{3}
\itemsep1pt\parskip0pt\parsep0pt
\item
sublist with roman numerals, starting with 4
\item
@ -400,6 +413,7 @@ Same thing but with paragraphs:
\begin{enumerate}
\def\labelenumiii{(\Alph{enumiii})}
\itemsep1pt\parskip0pt\parsep0pt
\item
a subsublist
\item
@ -412,23 +426,27 @@ Nesting:
\begin{enumerate}
\def\labelenumi{\Alph{enumi}.}
\itemsep1pt\parskip0pt\parsep0pt
\item
Upper Alpha
\begin{enumerate}
\def\labelenumii{\Roman{enumii}.}
\itemsep1pt\parskip0pt\parsep0pt
\item
Upper Roman.
\begin{enumerate}
\def\labelenumiii{(\arabic{enumiii})}
\setcounter{enumiii}{5}
\itemsep1pt\parskip0pt\parsep0pt
\item
Decimal start with 6
\begin{enumerate}
\def\labelenumiv{\alph{enumiv})}
\setcounter{enumiv}{2}
\itemsep1pt\parskip0pt\parsep0pt
\item
Lower alpha with paren
\end{enumerate}
@ -439,12 +457,14 @@ Nesting:
Autonumbering:
\begin{enumerate}
\itemsep1pt\parskip0pt\parsep0pt
\item
Autonumber.
\item
More.
\begin{enumerate}
\itemsep1pt\parskip0pt\parsep0pt
\item
Nested.
\end{enumerate}
@ -463,6 +483,7 @@ B. Williams
Tight using spaces:
\begin{description}
\itemsep1pt\parskip0pt\parsep0pt
\item[apple]
red fruit
\item[orange]
@ -474,6 +495,7 @@ yellow fruit
Tight using tabs:
\begin{description}
\itemsep1pt\parskip0pt\parsep0pt
\item[apple]
red fruit
\item[orange]
@ -515,6 +537,7 @@ orange block quote
Multiple definitions, tight:
\begin{description}
\itemsep1pt\parskip0pt\parsep0pt
\item[apple]
red fruit
@ -550,6 +573,7 @@ orange fruit
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\itemsep1pt\parskip0pt\parsep0pt
\item
sublist
\item
@ -675,6 +699,7 @@ Ellipses\ldots{}and\ldots{}and\ldots{}.
\section{LaTeX}
\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
\cite[22-23]{smith.1899}
\item
@ -697,6 +722,7 @@ Ellipses\ldots{}and\ldots{}and\ldots{}.
These shouldn't be math:
\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
To get the famous equation, write \texttt{\$e = mc\^{}2\$}.
\item
@ -723,6 +749,7 @@ Cat & 1 \\ \hline
Here is some unicode:
\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
I hat: Î
\item
@ -846,6 +873,7 @@ Here's an \href{/script?foo=1\&bar=2}{inline link in pointy braces}.
With an ampersand: \url{http://example.com/?foo=1\&bar=2}
\begin{itemize}
\itemsep1pt\parskip0pt\parsep0pt
\item
In a list?
\item
@ -910,6 +938,7 @@ Notes can go in quotes.\footnote{In quote.}
\begin{enumerate}
\def\labelenumi{\arabic{enumi}.}
\itemsep1pt\parskip0pt\parsep0pt
\item
And in list items.\footnote{In list.}
\end{enumerate}