diff options
Diffstat (limited to 'tests/Tests/Readers/Org.hs')
-rw-r--r-- | tests/Tests/Readers/Org.hs | 93 |
1 files changed, 72 insertions, 21 deletions
diff --git a/tests/Tests/Readers/Org.hs b/tests/Tests/Readers/Org.hs index b1aaaacad..2bde26f0f 100644 --- a/tests/Tests/Readers/Org.hs +++ b/tests/Tests/Readers/Org.hs @@ -109,10 +109,9 @@ tests = , "seven*eight* nine*" , "+not+funny+" ] =?> - para (spcSep [ "this+that+", "+so+on" - , "seven*eight*", "nine*" - , strikeout "not+funny" - ]) + para ("this+that+ +so+on" <> softbreak <> + "seven*eight* nine*" <> softbreak <> + strikeout "not+funny") , "No empty markup" =: "// ** __ ++ == ~~ $$" =?> @@ -142,8 +141,9 @@ tests = , "Inline math must stay within three lines" =: unlines [ "$a", "b", "c$", "$d", "e", "f", "g$" ] =?> - para ((math "a\nb\nc") <> space <> - spcSep [ "$d", "e", "f", "g$" ]) + para ((math "a\nb\nc") <> softbreak <> + "$d" <> softbreak <> "e" <> softbreak <> + "f" <> softbreak <> "g$") , "Single-character math" =: "$a$ $b$! $c$?" =?> @@ -153,14 +153,13 @@ tests = ]) , "Markup may not span more than two lines" =: - unlines [ "/this *is +totally", "nice+ not*", "emph/" ] =?> - para (spcSep [ "/this" - , (strong (spcSep - [ "is" - , (strikeout ("totally" <> space <> "nice")) - , "not" - ])) - , "emph/" ]) + "/this *is +totally\nnice+ not*\nemph/" =?> + para ("/this" <> space <> + strong ("is" <> space <> + strikeout ("totally" <> + softbreak <> "nice") <> + space <> "not") <> + softbreak <> "emph/") , "Sub- and superscript expressions" =: unlines [ "a_(a(b)(c)d)" @@ -174,7 +173,8 @@ tests = , "3_{{}}" , "4^(a(*b(c*)d))" ] =?> - para (spcSep [ "a" <> subscript "(a(b)(c)d)" + para (mconcat $ intersperse softbreak + [ "a" <> subscript "(a(b)(c)d)" , "e" <> superscript "(f(g)h)" , "i" <> (subscript "(jk)") <> "l)" , "m" <> (superscript "()") <> "n" @@ -264,6 +264,16 @@ tests = ) "echo 'Hello, World'") + , "Inline code block with toggle" =: + "src_sh[:toggle]{echo $HOME}" =?> + (para $ codeWith ( "" + , [ "bash", "rundoc-block" ] + , [ ("rundoc-language", "sh") + , ("rundoc-toggle", "yes") + ] + ) + "echo $HOME") + , "Citation" =: "[@nonexistent]" =?> let citation = Citation @@ -394,13 +404,13 @@ tests = unlines [ " :LOGBOOK: foo" , " :END:" ] =?> - para (spcSep [ ":LOGBOOK:", "foo", ":END:" ]) + para (":LOGBOOK:" <> space <> "foo" <> softbreak <> ":END:") , "Drawers with unknown names are just text" =: unlines [ ":FOO:" , ":END:" ] =?> - para (":FOO:" <> space <> ":END:") + para (":FOO:" <> softbreak <> ":END:") , "Anchor reference" =: unlines [ "<<link-here>> Target." @@ -529,6 +539,17 @@ tests = "* This: is not: tagged" =?> headerWith ("this-is-not-tagged", [], []) 1 "This: is not: tagged" + , "Header starting with strokeout text" =: + unlines [ "foo" + , "" + , "* +thing+ other thing" + ] =?> + mconcat [ para "foo" + , headerWith ("thing-other-thing", [], []) + 1 + ((strikeout "thing") <> " other thing") + ] + , "Comment Trees" =: unlines [ "* COMMENT A comment tree" , " Not much going on here" @@ -556,7 +577,7 @@ tests = unlines [ "lucky" , "*star" ] =?> - para ("lucky" <> space <> "*star") + para ("lucky" <> softbreak <> "*star") , "Example block" =: unlines [ ": echo hello" @@ -688,8 +709,8 @@ tests = " Tony*\n" ++ "- /Sideshow\n" ++ " Bob/") =?> - bulletList [ plain $ strong ("Fat" <> space <> "Tony") - , plain $ emph ("Sideshow" <> space <> "Bob") + bulletList [ plain $ strong ("Fat" <> softbreak <> "Tony") + , plain $ emph ("Sideshow" <> softbreak <> "Bob") ] , "Nested Bullet Lists" =: @@ -820,7 +841,7 @@ tests = unlines [ "- PLL :: phase-locked loop" , "- TTL ::" , " transistor-transistor logic" - , "- PSK::phase-shift keying" + , "- PSK :: phase-shift keying" , "" , " a digital modulation scheme" ] =?> @@ -859,6 +880,10 @@ tests = , headerWith ("header", [], []) 1 "header" ] + , "Definition lists double-colon markers must be surrounded by whitespace" =: + "- std::cout" =?> + bulletList [ plain "std::cout" ] + , "Loose bullet list" =: unlines [ "- apple" , "" @@ -870,6 +895,14 @@ tests = , para "orange" , para "peach" ] + + , "Recognize preceding paragraphs in non-list contexts" =: + unlines [ "CLOSED: [2015-10-19 Mon 15:03]" + , "- Note taken on [2015-10-19 Mon 13:24]" + ] =?> + mconcat [ para "CLOSED: [2015-10-19 Mon 15:03]" + , bulletList [ plain "Note taken on [2015-10-19 Mon 13:24]" ] + ] ] , testGroup "Tables" @@ -1094,6 +1127,15 @@ tests = , ": 65" ] =?> rawBlock "html" "" + , "Source block with toggling header arguments" =: + unlines [ "#+BEGIN_SRC sh :noeval" + , "echo $HOME" + , "#+END_SRC" + ] =?> + let classes = [ "bash", "rundoc-block" ] + params = [ ("rundoc-language", "sh"), ("rundoc-noeval", "yes") ] + in codeBlockWith ("", classes, params) "echo $HOME\n" + , "Example block" =: unlines [ "#+begin_example" , "A chosen representation of" @@ -1208,6 +1250,7 @@ tests = ] in codeBlockWith ( "", classes, params) "code body\n" ] + , testGroup "Smart punctuation" [ test orgSmart "quote before ellipses" ("'...hi'" @@ -1228,5 +1271,13 @@ tests = , test orgSmart "Dashes are allowed at the borders of emphasis'" ("/foo---/" =?> para (emph "foo—")) + + , test orgSmart "Single quotes can be followed by emphasized text" + ("Singles on the '/meat market/'" =?> + para ("Singles on the " <> (singleQuoted $ emph "meat market"))) + + , test orgSmart "Double quotes can be followed by emphasized text" + ("Double income, no kids: \"/DINK/\"" =?> + para ("Double income, no kids: " <> (doubleQuoted $ emph "DINK"))) ] ] |