diff options
| author | John MacFarlane <[email protected]> | 2021-03-11 15:49:27 -0800 |
|---|---|---|
| committer | John MacFarlane <[email protected]> | 2021-03-13 15:05:37 -0800 |
| commit | 8be95ad8e5150d5cab66c4abdf59baaf4670c6c8 (patch) | |
| tree | 9655036efbaabda6a2a7802dc971c7fba5a987ca /test/Tests/Readers/Org | |
| parent | 35b66a76718205c303f416bf0afc01c098e8a171 (diff) | |
Use custom Prelude based on relude.relude
The Prelude now longer exports partial functions, so
a large number of uses of these functions in the
code base have been rewritten.
A .ghci file has been added; this is necessary for
ghci to work properly with the custom Prelude.
Currently there are lots of compiler warnings.
We should either fix these or go to using a custom
Prelude that changes less than relude.
Diffstat (limited to 'test/Tests/Readers/Org')
| -rw-r--r-- | test/Tests/Readers/Org/Directive.hs | 4 | ||||
| -rw-r--r-- | test/Tests/Readers/Org/Inline/Citation.hs | 14 | ||||
| -rw-r--r-- | test/Tests/Readers/Org/Meta.hs | 18 | ||||
| -rw-r--r-- | test/Tests/Readers/Org/Shared.hs | 2 |
4 files changed, 19 insertions, 19 deletions
diff --git a/test/Tests/Readers/Org/Directive.hs b/test/Tests/Readers/Org/Directive.hs index 85d1bc088..c2409ce80 100644 --- a/test/Tests/Readers/Org/Directive.hs +++ b/test/Tests/Readers/Org/Directive.hs @@ -15,14 +15,14 @@ module Tests.Readers.Org.Directive (tests) where import Data.Time (UTCTime (UTCTime), secondsToDiffTime) import Data.Time.Calendar (Day (ModifiedJulianDay)) import Test.Tasty (TestTree, testGroup) -import Tests.Helpers ((=?>), ToString, purely, test) +import Tests.Helpers ((=?>), ToString, ToText, purely, test) import Tests.Readers.Org.Shared ((=:), tagSpan) import Text.Pandoc import Text.Pandoc.Builder import qualified Data.ByteString as BS import qualified Data.Text as T -testWithFiles :: (ToString c) +testWithFiles :: (ToText c) => [(FilePath, BS.ByteString)] -> String -- ^ name of test case -> (T.Text, c) -- ^ (input, expected value) diff --git a/test/Tests/Readers/Org/Inline/Citation.hs b/test/Tests/Readers/Org/Inline/Citation.hs index a11804983..fa1560772 100644 --- a/test/Tests/Readers/Org/Inline/Citation.hs +++ b/test/Tests/Readers/Org/Inline/Citation.hs @@ -15,7 +15,7 @@ module Tests.Readers.Org.Inline.Citation (tests) where import Test.Tasty (TestTree, testGroup) import Tests.Helpers ((=?>)) import Tests.Readers.Org.Shared ((=:)) -import Text.Pandoc.Builder +import Text.Pandoc.Builder as B tests :: [TestTree] tests = @@ -160,8 +160,8 @@ tests = "[[citep:Dominik201408][See page 20::, for example]]" =?> let citation = Citation { citationId = "Dominik201408" - , citationPrefix = toList "See page 20" - , citationSuffix = toList ", for example" + , citationPrefix = B.toList "See page 20" + , citationSuffix = B.toList ", for example" , citationMode = NormalCitation , citationNoteNum = 0 , citationHash = 0 @@ -198,17 +198,17 @@ tests = , "Berkeley-style parenthetical citation list" =: "[(cite): see; @Dominik201408;also @Pandoc; and others]" =?> let pandocCite' = pandocCite { - citationPrefix = toList "also" - , citationSuffix = toList "and others" + citationPrefix = B.toList "also" + , citationSuffix = B.toList "and others" } dominikCite' = dominikCite { - citationPrefix = toList "see" + citationPrefix = B.toList "see" } in (para $ cite [dominikCite', pandocCite'] "") , "Berkeley-style plain citation list" =: "[cite: See; @Dominik201408; and @Pandoc; and others]" =?> - let pandocCite' = pandocInText { citationPrefix = toList "and" } + let pandocCite' = pandocInText { citationPrefix = B.toList "and" } in (para $ "See " <> cite [dominikInText] "" <> "," <> space diff --git a/test/Tests/Readers/Org/Meta.hs b/test/Tests/Readers/Org/Meta.hs index 6363d84b0..f38ee7194 100644 --- a/test/Tests/Readers/Org/Meta.hs +++ b/test/Tests/Readers/Org/Meta.hs @@ -16,7 +16,7 @@ import Test.Tasty (TestTree, testGroup) import Tests.Helpers ((=?>)) import Tests.Readers.Org.Shared ((=:), spcSep) import Text.Pandoc -import Text.Pandoc.Builder +import Text.Pandoc.Builder as B import qualified Data.Text as T tests :: [TestTree] @@ -43,14 +43,14 @@ tests = , testGroup "Export settings" [ "Title" =: "#+title: Hello, World" =?> - let titleInline = toList $ "Hello," <> space <> "World" + let titleInline = B.toList $ "Hello," <> space <> "World" meta = setMeta "title" (MetaInlines titleInline) nullMeta in Pandoc meta mempty , testGroup "Author" [ "sets 'author' field" =: "#+author: John /Emacs-Fanboy/ Doe" =?> - let author = toList . spcSep $ [ "John", emph "Emacs-Fanboy", "Doe" ] + let author = B.toList . spcSep $ [ "John", emph "Emacs-Fanboy", "Doe" ] meta = setMeta "author" (MetaInlines author) nullMeta in Pandoc meta mempty @@ -58,8 +58,8 @@ tests = T.unlines [ "#+author: James Dewey Watson," , "#+author: Francis Harry Compton Crick" ] =?> - let watson = toList "James Dewey Watson," - crick = toList "Francis Harry Compton Crick" + let watson = B.toList "James Dewey Watson," + crick = B.toList "Francis Harry Compton Crick" meta = setMeta "author" (MetaInlines (watson ++ SoftBreak : crick)) nullMeta @@ -68,7 +68,7 @@ tests = , "Date" =: "#+date: Feb. *28*, 2014" =?> - let date = toList . spcSep $ [ "Feb.", strong "28" <> ",", "2014" ] + let date = B.toList . spcSep $ [ "Feb.", strong "28" <> ",", "2014" ] meta = setMeta "date" (MetaInlines date) nullMeta in Pandoc meta mempty @@ -102,7 +102,7 @@ tests = T.unlines [ "#+keywords: pandoc, testing," , "#+keywords: Org" ] =?> - let keywords = toList $ "pandoc, testing," <> softbreak <> "Org" + let keywords = B.toList $ "pandoc, testing," <> softbreak <> "Org" meta = setMeta "keywords" (MetaInlines keywords) nullMeta in Pandoc meta mempty @@ -128,7 +128,7 @@ tests = [ "LATEX_HEADER" =: "#+latex_header: \\usepackage{tikz}" =?> let latexInlines = rawInline "latex" "\\usepackage{tikz}" - inclList = MetaList [MetaInlines (toList latexInlines)] + inclList = MetaList [MetaInlines (B.toList latexInlines)] meta = setMeta "header-includes" inclList nullMeta in Pandoc meta mempty @@ -162,7 +162,7 @@ tests = [ "HTML_HEAD values are added to header-includes" =: "#+html_head: <meta/>" =?> let html = rawInline "html" "<meta/>" - inclList = MetaList [MetaInlines (toList html)] + inclList = MetaList [MetaInlines (B.toList html)] meta = setMeta "header-includes" inclList nullMeta in Pandoc meta mempty diff --git a/test/Tests/Readers/Org/Shared.hs b/test/Tests/Readers/Org/Shared.hs index c584eff19..a1baaf75e 100644 --- a/test/Tests/Readers/Org/Shared.hs +++ b/test/Tests/Readers/Org/Shared.hs @@ -29,7 +29,7 @@ org :: Text -> Pandoc org = purely $ readOrg def{ readerExtensions = getDefaultExtensions "org" } infix 4 =: -(=:) :: ToString c +(=:) :: ToText c => String -> (Text, c) -> TestTree (=:) = test org |
