summaryrefslogtreecommitdiff
path: root/tests/Tests/Readers
diff options
context:
space:
mode:
authorAlbert Krewinkel <tarleb@moltkeplatz.de>2014-04-10 15:11:03 +0200
committerAlbert Krewinkel <tarleb@moltkeplatz.de>2014-04-10 15:32:02 +0200
commit1715d7cee0b9388ac77b8b2a31fcbb00ead80adf (patch)
tree92c4f0d3df14d2b9e065336a2bb994da00acb6f0 /tests/Tests/Readers
parenta9eb0caabbb37d7ceb6f6791f375eac4b509b058 (diff)
Org reader: Support more inline/display math variants
Support all of the following variants as valid ways to define inline or display math inlines: - `\[..\]` (display) - `$$..$$` (display) - `\(..\)` (inline) - `$..$` (inline) This closes #1223. Again.
Diffstat (limited to 'tests/Tests/Readers')
-rw-r--r--tests/Tests/Readers/Org.hs36
1 files changed, 30 insertions, 6 deletions
diff --git a/tests/Tests/Readers/Org.hs b/tests/Tests/Readers/Org.hs
index efd8fe977..9e9482e45 100644
--- a/tests/Tests/Readers/Org.hs
+++ b/tests/Tests/Readers/Org.hs
@@ -54,14 +54,26 @@ tests =
"=Robot.rock()=" =?>
para (code "Robot.rock()")
- , "Math" =:
- "$E=mc^2$" =?>
- para (math "E=mc^2")
-
, "Verbatim" =:
"~word for word~" =?>
para (rawInline "" "word for word")
+ , "Math $..$" =:
+ "$E=mc^2$" =?>
+ para (math "E=mc^2")
+
+ , "Math $$..$$" =:
+ "$$E=mc^2$$" =?>
+ para (displayMath "E=mc^2")
+
+ , "Math \\[..\\]" =:
+ "\\[E=ℎν\\]" =?>
+ para (displayMath "E=ℎν")
+
+ , "Math \\(..\\)" =:
+ "\\(σ_x σ_p ≥ \\frac{ℏ}{2}\\)" =?>
+ para (math "σ_x σ_p ≥ \\frac{ℏ}{2}")
+
, "Symbol" =:
"A * symbol" =?>
para (str "A" <> space <> str "*" <> space <> "symbol")
@@ -86,14 +98,19 @@ tests =
unlines [ "this+that+ +so+on"
, "seven*eight* nine*"
, "+not+funny+"
- , "this == self"
] =?>
para (spcSep [ "this+that+", "+so+on"
, "seven*eight*", "nine*"
, strikeout "not+funny"
- , "this" <> space <> "==" <> space <> "self"
])
+ , "No empty markup" =:
+ -- FIXME: __ is erroneously parsed as subscript "_"
+ -- "// ** __ ++ == ~~ $$" =?>
+ -- para (spcSep [ "//", "**", "__", "++", "==", "~~", "$$" ])
+ "// ** ++ == ~~ $$" =?>
+ para (spcSep [ "//", "**", "++", "==", "~~", "$$" ])
+
, "Adherence to Org's rules for markup borders" =:
"/t/& a/ / ./r/ (*l*) /e/! /b/." =?>
para (spcSep [ emph $ "t/&" <> space <> "a"
@@ -109,6 +126,13 @@ tests =
para ((math "a\nb\nc") <> space <>
spcSep [ "$d", "e", "f", "g$" ])
+ , "Single-character math" =:
+ "$a$ $b$! $c$?" =?>
+ para (spcSep [ math "a"
+ , "$b$!"
+ , (math "c") <> "?"
+ ])
+
, "Markup may not span more than two lines" =:
unlines [ "/this *is +totally", "nice+ not*", "emph/" ] =?>
para (spcSep [ "/this"