From acf526f68d0ecb3ddf4ddd6efcee7774cd8ffa54 Mon Sep 17 00:00:00 2001 From: Łukasz Hanuszczak Date: Wed, 19 Aug 2015 14:43:39 +0200 Subject: Setup test suite for Hoogle backend. --- hoogle-test/Main.hs | 27 +++++++++++++++++++++++++++ hoogle-test/run | 5 +++++ 2 files changed, 32 insertions(+) create mode 100644 hoogle-test/Main.hs create mode 100755 hoogle-test/run (limited to 'hoogle-test') diff --git a/hoogle-test/Main.hs b/hoogle-test/Main.hs new file mode 100644 index 00000000..9da20c36 --- /dev/null +++ b/hoogle-test/Main.hs @@ -0,0 +1,27 @@ +{-# LANGUAGE CPP #-} + + +import System.Environment +import System.FilePath + +import Test.Haddock + + +checkConfig :: CheckConfig String +checkConfig = CheckConfig + { ccfgRead = \_ input -> Just input + , ccfgDump = id + , ccfgEqual = (==) + } + + +dirConfig :: DirConfig +dirConfig = defaultDirConfig $ takeDirectory __FILE__ + + +main :: IO () +main = do + cfg <- parseArgs checkConfig dirConfig =<< getArgs + runAndCheck $ cfg + { cfgHaddockArgs = cfgHaddockArgs cfg ++ ["--hoogle"] + } diff --git a/hoogle-test/run b/hoogle-test/run new file mode 100755 index 00000000..5e17ad0f --- /dev/null +++ b/hoogle-test/run @@ -0,0 +1,5 @@ +#!/bin/bash + +export HADDOCK_PATH=$(which haddock) +LIB_PATH="$(dirname "$BASH_SOURCE")/../haddock-test/src/" +runhaskell -i:"$LIB_PATH" "Main.hs" $@ -- cgit v1.2.3 From 109ebe47a7141b477844ba52291785969f01514c Mon Sep 17 00:00:00 2001 From: Łukasz Hanuszczak Date: Wed, 19 Aug 2015 16:13:55 +0200 Subject: Add appropriate .gitignore entry and configure Hoogle test suite. --- .gitignore | 1 + hoogle-test/Main.hs | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'hoogle-test') diff --git a/.gitignore b/.gitignore index 3eb2ed83..2bbb0885 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ /html-test/out/ /hypsrc-test/out/ /latex-test/out/ +/hoogle-test/out/ /doc/haddock /doc/haddock.ps diff --git a/hoogle-test/Main.hs b/hoogle-test/Main.hs index 9da20c36..c8cda640 100644 --- a/hoogle-test/Main.hs +++ b/hoogle-test/Main.hs @@ -23,5 +23,9 @@ main :: IO () main = do cfg <- parseArgs checkConfig dirConfig =<< getArgs runAndCheck $ cfg - { cfgHaddockArgs = cfgHaddockArgs cfg ++ ["--hoogle"] + { cfgHaddockArgs = cfgHaddockArgs cfg ++ + [ "--package-name=test" + , "--package-version=0.0.0" + , "--hoogle" + ] } -- cgit v1.2.3 From 3378ef409170ae1f319c934876d2b9e1a14bb9a8 Mon Sep 17 00:00:00 2001 From: Łukasz Hanuszczak Date: Wed, 19 Aug 2015 17:07:25 +0200 Subject: Create simple test cases for Hoogle backend. --- hoogle-test/src/assoc-types/AssocTypes.hs | 23 +++++++++++++++++++++++ hoogle-test/src/classes/Classes.hs | 16 ++++++++++++++++ hoogle-test/src/fixity/Fixity.hs | 12 ++++++++++++ hoogle-test/src/modules/Bar.hs | 12 ++++++++++++ hoogle-test/src/modules/Foo.hs | 9 +++++++++ 5 files changed, 72 insertions(+) create mode 100644 hoogle-test/src/assoc-types/AssocTypes.hs create mode 100644 hoogle-test/src/classes/Classes.hs create mode 100644 hoogle-test/src/fixity/Fixity.hs create mode 100644 hoogle-test/src/modules/Bar.hs create mode 100644 hoogle-test/src/modules/Foo.hs (limited to 'hoogle-test') diff --git a/hoogle-test/src/assoc-types/AssocTypes.hs b/hoogle-test/src/assoc-types/AssocTypes.hs new file mode 100644 index 00000000..a9bdc6d8 --- /dev/null +++ b/hoogle-test/src/assoc-types/AssocTypes.hs @@ -0,0 +1,23 @@ +{-# LANGUAGE TypeFamilies #-} + + +module AssocTypes where + + +class Foo a where + + type Bar a b + type Baz a + + type Baz a = [(a, a)] + + bar :: Bar a a + bar = undefined + + +instance Foo [a] where + + type Bar [a] Int = [(a, Bool)] + type Bar [a] Bool = [(Int, a)] + + type Baz [a] = (a, a, a) diff --git a/hoogle-test/src/classes/Classes.hs b/hoogle-test/src/classes/Classes.hs new file mode 100644 index 00000000..23f68499 --- /dev/null +++ b/hoogle-test/src/classes/Classes.hs @@ -0,0 +1,16 @@ +module Classes where + + +class Foo f where + + bar :: f a -> f b -> f (a, b) + baz :: f () + + baz = undefined + + +class Quux q where + + (+++), (///) :: q -> q -> q + (***), logBase :: q -> q -> q + foo, quux :: q -> q -> q diff --git a/hoogle-test/src/fixity/Fixity.hs b/hoogle-test/src/fixity/Fixity.hs new file mode 100644 index 00000000..3af38117 --- /dev/null +++ b/hoogle-test/src/fixity/Fixity.hs @@ -0,0 +1,12 @@ +module Fixity where + + +(+++), (***), (///) :: a -> a -> a +(+++) = undefined +(***) = undefined +(///) = undefined + + +infix 6 +++ +infixl 7 *** +infixr 8 /// diff --git a/hoogle-test/src/modules/Bar.hs b/hoogle-test/src/modules/Bar.hs new file mode 100644 index 00000000..156a835f --- /dev/null +++ b/hoogle-test/src/modules/Bar.hs @@ -0,0 +1,12 @@ +module Bar where + + +import Foo + + +bar :: Int -> Int +bar x = foo' x x + + +bar' :: Int -> Int -> Int +bar' x y = foo' (bar (foo x)) (bar (foo y)) diff --git a/hoogle-test/src/modules/Foo.hs b/hoogle-test/src/modules/Foo.hs new file mode 100644 index 00000000..6581fe4c --- /dev/null +++ b/hoogle-test/src/modules/Foo.hs @@ -0,0 +1,9 @@ +module Foo where + + +foo :: Int -> Int +foo = (* 2) + + +foo' :: Int -> Int -> Int +foo' x y = foo x + foo y -- cgit v1.2.3 From f2b7e4d0b7be232841e86edabf5152f242976105 Mon Sep 17 00:00:00 2001 From: Łukasz Hanuszczak Date: Sat, 22 Aug 2015 23:28:19 +0200 Subject: Improve portability of test runner scripts. --- hoogle-test/run | 5 +++-- html-test/run | 5 +++-- hypsrc-test/run | 5 +++-- latex-test/run | 5 +++-- 4 files changed, 12 insertions(+), 8 deletions(-) (limited to 'hoogle-test') diff --git a/hoogle-test/run b/hoogle-test/run index 5e17ad0f..3e72be80 100755 --- a/hoogle-test/run +++ b/hoogle-test/run @@ -1,5 +1,6 @@ -#!/bin/bash +#!/usr/bin/env bash export HADDOCK_PATH=$(which haddock) LIB_PATH="$(dirname "$BASH_SOURCE")/../haddock-test/src/" -runhaskell -i:"$LIB_PATH" "Main.hs" $@ +MAIN_PATH="$(dirname "$BASH_SOURCE")/Main.hs" +runhaskell -i:"$LIB_PATH" $MAIN_PATH $@ diff --git a/html-test/run b/html-test/run index 5e17ad0f..3e72be80 100755 --- a/html-test/run +++ b/html-test/run @@ -1,5 +1,6 @@ -#!/bin/bash +#!/usr/bin/env bash export HADDOCK_PATH=$(which haddock) LIB_PATH="$(dirname "$BASH_SOURCE")/../haddock-test/src/" -runhaskell -i:"$LIB_PATH" "Main.hs" $@ +MAIN_PATH="$(dirname "$BASH_SOURCE")/Main.hs" +runhaskell -i:"$LIB_PATH" $MAIN_PATH $@ diff --git a/hypsrc-test/run b/hypsrc-test/run index 5e17ad0f..3e72be80 100755 --- a/hypsrc-test/run +++ b/hypsrc-test/run @@ -1,5 +1,6 @@ -#!/bin/bash +#!/usr/bin/env bash export HADDOCK_PATH=$(which haddock) LIB_PATH="$(dirname "$BASH_SOURCE")/../haddock-test/src/" -runhaskell -i:"$LIB_PATH" "Main.hs" $@ +MAIN_PATH="$(dirname "$BASH_SOURCE")/Main.hs" +runhaskell -i:"$LIB_PATH" $MAIN_PATH $@ diff --git a/latex-test/run b/latex-test/run index 5e17ad0f..3e72be80 100755 --- a/latex-test/run +++ b/latex-test/run @@ -1,5 +1,6 @@ -#!/bin/bash +#!/usr/bin/env bash export HADDOCK_PATH=$(which haddock) LIB_PATH="$(dirname "$BASH_SOURCE")/../haddock-test/src/" -runhaskell -i:"$LIB_PATH" "Main.hs" $@ +MAIN_PATH="$(dirname "$BASH_SOURCE")/Main.hs" +runhaskell -i:"$LIB_PATH" $MAIN_PATH $@ -- cgit v1.2.3 From 5b427d2a86f09832ba4e86a314abc821e4715aae Mon Sep 17 00:00:00 2001 From: Łukasz Hanuszczak Date: Mon, 24 Aug 2015 23:09:47 +0200 Subject: Accept output for Hoogle and LaTeX backends. --- hoogle-test/ref/assoc-types/test.txt | 14 ++++++++++++++ hoogle-test/ref/classes/test.txt | 17 +++++++++++++++++ hoogle-test/ref/fixity/test.txt | 13 +++++++++++++ hoogle-test/ref/modules/test.txt | 13 +++++++++++++ latex-test/ref/Simple/Simple.tex | 3 +-- 5 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 hoogle-test/ref/assoc-types/test.txt create mode 100644 hoogle-test/ref/classes/test.txt create mode 100644 hoogle-test/ref/fixity/test.txt create mode 100644 hoogle-test/ref/modules/test.txt (limited to 'hoogle-test') diff --git a/hoogle-test/ref/assoc-types/test.txt b/hoogle-test/ref/assoc-types/test.txt new file mode 100644 index 00000000..ba1a145a --- /dev/null +++ b/hoogle-test/ref/assoc-types/test.txt @@ -0,0 +1,14 @@ +-- Hoogle documentation, generated by Haddock +-- See Hoogle, http://www.haskell.org/hoogle/ + +@package test +@version 0.0.0 + +module AssocTypes +class Foo a where { + type family Bar a b; + type family Baz a; + type Baz a = [(a, a)]; +} +bar :: Foo a => Bar a a +instance AssocTypes.Foo [a] diff --git a/hoogle-test/ref/classes/test.txt b/hoogle-test/ref/classes/test.txt new file mode 100644 index 00000000..69f224eb --- /dev/null +++ b/hoogle-test/ref/classes/test.txt @@ -0,0 +1,17 @@ +-- Hoogle documentation, generated by Haddock +-- See Hoogle, http://www.haskell.org/hoogle/ + +@package test +@version 0.0.0 + +module Classes +class Foo f +bar :: Foo f => f a -> f b -> f (a, b) +baz :: Foo f => f () +class Quux q +(+++) :: Quux q => q -> q -> q +(///) :: Quux q => q -> q -> q +(***) :: Quux q => q -> q -> q +logBase :: Quux q => q -> q -> q +foo :: Quux q => q -> q -> q +quux :: Quux q => q -> q -> q diff --git a/hoogle-test/ref/fixity/test.txt b/hoogle-test/ref/fixity/test.txt new file mode 100644 index 00000000..6f609539 --- /dev/null +++ b/hoogle-test/ref/fixity/test.txt @@ -0,0 +1,13 @@ +-- Hoogle documentation, generated by Haddock +-- See Hoogle, http://www.haskell.org/hoogle/ + +@package test +@version 0.0.0 + +module Fixity +(+++) :: a -> a -> a +infix 6 +++ +(***) :: a -> a -> a +infixl 7 *** +(///) :: a -> a -> a +infixr 8 /// diff --git a/hoogle-test/ref/modules/test.txt b/hoogle-test/ref/modules/test.txt new file mode 100644 index 00000000..6705b790 --- /dev/null +++ b/hoogle-test/ref/modules/test.txt @@ -0,0 +1,13 @@ +-- Hoogle documentation, generated by Haddock +-- See Hoogle, http://www.haskell.org/hoogle/ + +@package test +@version 0.0.0 + +module Foo +foo :: Int -> Int +foo' :: Int -> Int -> Int + +module Bar +bar :: Int -> Int +bar' :: Int -> Int -> Int diff --git a/latex-test/ref/Simple/Simple.tex b/latex-test/ref/Simple/Simple.tex index 89e849f8..5ba4712c 100644 --- a/latex-test/ref/Simple/Simple.tex +++ b/latex-test/ref/Simple/Simple.tex @@ -11,7 +11,6 @@ module Simple ( \item[\begin{tabular}{@{}l} foo\ ::\ t \end{tabular}]\haddockbegindoc -This is foo. -\par +This is foo.\par \end{haddockdesc} \ No newline at end of file -- cgit v1.2.3