From f3e76a50eec28d17ddd0fe8e965c15c19c4ef3cf Mon Sep 17 00:00:00 2001
From: Alec Theriault <alec.theriault@gmail.com>
Date: Fri, 20 Jul 2018 04:50:00 -0700
Subject: Misc tests (#858)

* More tests

* spliced types
* constructor/pattern argument docs
* strictness marks on fields with argument docs

* latex test cases need seperate directory

* Accept tests
---
 .../GadtConstructorArgs/GadtConstructorArgs.tex    | 25 ++++++++++
 latex-test/ref/GadtConstructorArgs/haddock.sty     | 57 ++++++++++++++++++++++
 latex-test/ref/GadtConstructorArgs/main.tex        | 11 +++++
 3 files changed, 93 insertions(+)
 create mode 100644 latex-test/ref/GadtConstructorArgs/GadtConstructorArgs.tex
 create mode 100644 latex-test/ref/GadtConstructorArgs/haddock.sty
 create mode 100644 latex-test/ref/GadtConstructorArgs/main.tex

(limited to 'latex-test/ref/GadtConstructorArgs')

diff --git a/latex-test/ref/GadtConstructorArgs/GadtConstructorArgs.tex b/latex-test/ref/GadtConstructorArgs/GadtConstructorArgs.tex
new file mode 100644
index 00000000..7aaf5512
--- /dev/null
+++ b/latex-test/ref/GadtConstructorArgs/GadtConstructorArgs.tex
@@ -0,0 +1,25 @@
+\haddockmoduleheading{GadtConstructorArgs}
+\label{module:GadtConstructorArgs}
+\haddockbeginheader
+{\haddockverb\begin{verbatim}
+module GadtConstructorArgs (
+    Boo(Fot, Fob, x, y, w, z)
+  ) where\end{verbatim}}
+\haddockendheader
+
+\begin{haddockdesc}
+\item[\begin{tabular}{@{}l}
+data\ Boo\ where
+\end{tabular}]\haddockbegindoc
+\enspace \emph{Constructors}\par
+\haddockbeginconstrs
+& \haddockdecltt{Fot} & \\
+                        & \qquad \haddockdecltt{:: \{} \enspace \haddockdecltt{x :: Int} & an \haddockid{x} \\
+                        & \qquad \haddockdecltt{\ \ \ \ ,} \enspace \haddockdecltt{y :: Int} & a \haddockid{y} \\
+                        & \qquad \haddockdecltt{\ \ \ \ \} ->} \enspace \haddockdecltt{Boo} & \\
+& \haddockdecltt{Fob} & Record GADT with docs \\
+                        & \qquad \haddockdecltt{:: \{} \enspace \haddockdecltt{w :: Int} & a \haddockid{w} \\
+                        & \qquad \haddockdecltt{\ \ \ \ ,} \enspace \haddockdecltt{z :: Int} & a \haddockid{z} \\
+                        & \qquad \haddockdecltt{\ \ \ \ \} ->} \enspace \haddockdecltt{Boo} & a \haddockid{Boo} \\
+\end{tabulary}\par
+\end{haddockdesc}
\ No newline at end of file
diff --git a/latex-test/ref/GadtConstructorArgs/haddock.sty b/latex-test/ref/GadtConstructorArgs/haddock.sty
new file mode 100644
index 00000000..6e031a98
--- /dev/null
+++ b/latex-test/ref/GadtConstructorArgs/haddock.sty
@@ -0,0 +1,57 @@
+% Default Haddock style definitions.  To use your own style, invoke
+% Haddock with the option --latex-style=mystyle.
+
+\usepackage{tabulary} % see below
+
+% make hyperlinks in the PDF, and add an expandabale index
+\usepackage[pdftex,bookmarks=true]{hyperref}
+
+\newenvironment{haddocktitle}
+  {\begin{center}\bgroup\large\bfseries}
+  {\egroup\end{center}}
+\newenvironment{haddockprologue}{\vspace{1in}}{}
+
+\newcommand{\haddockmoduleheading}[1]{\chapter{\texttt{#1}}}
+
+\newcommand{\haddockbeginheader}{\hrulefill}
+\newcommand{\haddockendheader}{\noindent\hrulefill}
+
+% a little gap before the ``Methods'' header
+\newcommand{\haddockpremethods}{\vspace{2ex}}
+
+% inserted before \\begin{verbatim}
+\newcommand{\haddockverb}{\small}
+
+% an identifier: add an index entry
+\newcommand{\haddockid}[1]{\haddocktt{#1}\index{#1@\texttt{#1}}}
+
+% The tabulary environment lets us have a column that takes up ``the
+% rest of the space''.  Unfortunately it doesn't allow
+% the \end{tabulary} to be in the expansion of a macro, it must appear
+% literally in the document text, so Haddock inserts
+% the \end{tabulary} itself.
+\newcommand{\haddockbeginconstrs}{\begin{tabulary}{\linewidth}{@{}llJ@{}}}
+\newcommand{\haddockbeginargs}{\begin{tabulary}{\linewidth}{@{}llJ@{}}}
+
+\newcommand{\haddocktt}[1]{{\small \texttt{#1}}}
+\newcommand{\haddockdecltt}[1]{{\small\bfseries \texttt{#1}}}
+
+\makeatletter
+\newenvironment{haddockdesc}
+               {\list{}{\labelwidth\z@ \itemindent-\leftmargin
+                        \let\makelabel\haddocklabel}}
+               {\endlist}
+\newcommand*\haddocklabel[1]{\hspace\labelsep\haddockdecltt{#1}}
+\makeatother
+
+% after a declaration, start a new line for the documentation.
+% Otherwise, the documentation starts right after the declaration,
+% because we're using the list environment and the declaration is the
+% ``label''.  I tried making this newline part of the label, but
+% couldn't get that to work reliably (the space seemed to stretch
+% sometimes).
+\newcommand{\haddockbegindoc}{\hfill\\[1ex]}
+
+% spacing between paragraphs and no \parindent looks better
+\parskip=10pt plus2pt minus2pt
+\setlength{\parindent}{0cm}
diff --git a/latex-test/ref/GadtConstructorArgs/main.tex b/latex-test/ref/GadtConstructorArgs/main.tex
new file mode 100644
index 00000000..dc1a1aa3
--- /dev/null
+++ b/latex-test/ref/GadtConstructorArgs/main.tex
@@ -0,0 +1,11 @@
+\documentclass{book}
+\usepackage{haddock}
+\begin{document}
+\begin{titlepage}
+\begin{haddocktitle}
+
+\end{haddocktitle}
+\end{titlepage}
+\tableofcontents
+\input{GadtConstructorArgs}
+\end{document}
\ No newline at end of file
-- 
cgit v1.2.3