Last active
December 24, 2015 13:32
-
-
Save c-forster/e55a82501b132b394e14 to your computer and use it in GitHub Desktop.
Trying to Write New Tests for a New Pandoc Writer
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
{- | |
Copyright (C) 2006-2015 John MacFarlane <[email protected]> | |
This program is free software; you can redistribute it and/or modify | |
it under the terms of the GNU General Public License as published by | |
the Free Software Foundation; either version 2 of the License, or | |
(at your option) any later version. | |
This program is distributed in the hope that it will be useful, | |
but WITHOUT ANY WARRANTY; without even the implied warranty of | |
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
GNU General Public License for more details. | |
You should have received a copy of the GNU General Public License | |
along with this program; if not, write to the Free Software | |
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
-} | |
{- | | |
Module : Text.Pandoc.Writers.TEI | |
Copyright : Copyright (C) 2006-2015 John MacFarlane | |
License : GNU GPL, version 2 or above | |
Maintainer : John MacFarlane <[email protected]> | |
Stability : alpha | |
Portability : portable | |
Conversion of a 'Pandoc' document to a string representation. | |
-} | |
module Text.Pandoc.Writers.TEI ( writeTEI ) where | |
import Text.Pandoc.Options ( WriterOptions(..), WrapOption(..) ) | |
import Data.List ( intersperse ) | |
import Text.Pandoc.Definition | |
import Text.Pandoc.Pretty | |
writeTEI :: WriterOptions -> Pandoc -> String | |
writeTEI opts document = | |
"empty" | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# OPTIONS_GHC -Wall #-} | |
module Main where | |
import Test.Framework | |
import GHC.IO.Encoding | |
import qualified Tests.Old | |
import qualified Tests.Readers.LaTeX | |
import qualified Tests.Readers.Markdown | |
import qualified Tests.Readers.Org | |
import qualified Tests.Readers.HTML | |
import qualified Tests.Readers.RST | |
import qualified Tests.Readers.Docx | |
import qualified Tests.Readers.Odt | |
import qualified Tests.Readers.Txt2Tags | |
import qualified Tests.Readers.EPUB | |
import qualified Tests.Writers.ConTeXt | |
import qualified Tests.Writers.LaTeX | |
import qualified Tests.Writers.HTML | |
import qualified Tests.Writers.Docbook | |
import qualified Tests.Writers.Native | |
import qualified Tests.Writers.Markdown | |
import qualified Tests.Writers.Plain | |
import qualified Tests.Writers.AsciiDoc | |
import qualified Tests.Writers.Docx | |
import qualified Tests.Writers.RST | |
import qualified Tests.Writers.TEI | |
import qualified Tests.Shared | |
import qualified Tests.Walk | |
import Text.Pandoc.Shared (inDirectory) | |
import System.Environment (getArgs) | |
tests :: [Test] | |
tests = [ testGroup "Old" Tests.Old.tests | |
, testGroup "Shared" Tests.Shared.tests | |
, testGroup "Walk" Tests.Walk.tests | |
, testGroup "Writers" | |
[ testGroup "Native" Tests.Writers.Native.tests | |
, testGroup "ConTeXt" Tests.Writers.ConTeXt.tests | |
, testGroup "LaTeX" Tests.Writers.LaTeX.tests | |
, testGroup "HTML" Tests.Writers.HTML.tests | |
, testGroup "Docbook" Tests.Writers.Docbook.tests | |
, testGroup "Markdown" Tests.Writers.Markdown.tests | |
, testGroup "Plain" Tests.Writers.Plain.tests | |
, testGroup "AsciiDoc" Tests.Writers.AsciiDoc.tests | |
, testGroup "Docx" Tests.Writers.Docx.tests | |
, testGroup "RST" Tests.Writers.RST.tests | |
, testGroup "TEI" Tests.Writers.TEI.tests | |
] | |
, testGroup "Readers" | |
[ testGroup "LaTeX" Tests.Readers.LaTeX.tests | |
, testGroup "Markdown" Tests.Readers.Markdown.tests | |
, testGroup "HTML" Tests.Readers.HTML.tests | |
, testGroup "Org" Tests.Readers.Org.tests | |
, testGroup "RST" Tests.Readers.RST.tests | |
, testGroup "Docx" Tests.Readers.Docx.tests | |
, testGroup "Odt" Tests.Readers.Odt.tests | |
, testGroup "Txt2Tags" Tests.Readers.Txt2Tags.tests | |
, testGroup "EPUB" Tests.Readers.EPUB.tests | |
] | |
] | |
main :: IO () | |
main = do | |
setLocaleEncoding utf8 | |
args <- getArgs | |
inDirectory "tests" $ defaultMainWithArgs tests args |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
module Tests.Writers.TEI (tests) where | |
import Test.Framework | |
import Text.Pandoc.Builder | |
import Text.Pandoc | |
import Tests.Helpers | |
import Tests.Arbitrary() | |
{- | |
"my test" =: X =?> Y | |
is shorthand for | |
test html "my test" $ X =?> Y | |
which is in turn shorthand for | |
test html "my test" (X,Y) | |
-} | |
infix 4 =: | |
(=:) :: (ToString a, ToPandoc a) | |
=> String -> (a, String) -> Test | |
(=:) = test (writeTEI def . toPandoc) | |
tests :: [Test] | |
tests = [ testGroup "block elements" | |
["para" =: para "Lorem ipsum cetera." | |
=?> "<p>Lorem ipsum cetera.</p>" | |
] | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You are not importing
Text.Pandoc.Writers.TEI
inTests.Pandoc.TEI
. However, you probably also need to addText.Pandoc.Writers.TEI
to the.cabal
fie for it to work as well.