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 actual' = toString $ fn input
expected' = toString expected expected' = toString expected
diff = getDiff (lines expected') (lines actual') diff = getDiff (lines expected') (lines actual')
expected'' = unlines $ map vividize [Second x | Second x <- diff] expected'' = unlines $ map vividize [First x | First x <- diff]
actual'' = unlines $ map vividize [First x | First x <- diff] actual'' = unlines $ map vividize [Second x | Second x <- diff]
dashes "" = replicate 72 '-' dashes "" = replicate 72 '-'
dashes x = replicate (72 - length x - 5) '-' ++ " " ++ x ++ " ---" dashes x = replicate (72 - length x - 5) '-' ++ " " ++ x ++ " ---"

View file

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

View file

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

View file

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