aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAlbert Krewinkel <albert@zeitkraut.de>2020-04-04 14:27:27 +0200
committerAlbert Krewinkel <albert@zeitkraut.de>2020-04-04 14:27:27 +0200
commitc3f539364aea5065be1d6774cd62f40a1918e773 (patch)
tree250584088bdfc141e1f1844c32779ab33800c08b /test
parentd867cac8caa0171fcd32589a6827a69826c1b087 (diff)
downloadpandoc-c3f539364aea5065be1d6774cd62f40a1918e773.tar.gz
Jira: support citations, attachment links, and user links
Closes: #6231 Closes: #6238 Closes: #6239
Diffstat (limited to 'test')
-rw-r--r--test/Tests/Readers/Jira.hs36
-rw-r--r--test/Tests/Writers/Jira.hs34
2 files changed, 67 insertions, 3 deletions
diff --git a/test/Tests/Readers/Jira.hs b/test/Tests/Readers/Jira.hs
index 8e37968eb..30f55585b 100644
--- a/test/Tests/Readers/Jira.hs
+++ b/test/Tests/Readers/Jira.hs
@@ -111,6 +111,10 @@ tests =
"HCO ~3~^-^" =?>
para ("HCO " <> subscript "3" <> superscript "-")
+ , "citation" =:
+ "Et tu, Brute? ??Caesar??" =?>
+ para ("Et tu, Brute? — " <> emph "Caesar")
+
, "color" =:
"This is {color:red}red{color}." =?>
para ("This is " <> spanWith ("", [], [("color", "red")]) "red" <> ".")
@@ -123,9 +127,35 @@ tests =
"first\nsecond" =?>
para ("first" <> linebreak <> "second")
- , "link" =:
- "[Example|https://example.org]" =?>
- para (link "https://example.org" "" "Example")
+ , testGroup "links"
+ [ "external" =:
+ "[Example|https://example.org]" =?>
+ para (link "https://example.org" "" "Example")
+
+ , "email" =:
+ "[mailto:me@example.org]" =?>
+ para (link "mailto:me@example.org" "" "me@example.org")
+
+ , "email with description" =:
+ "[email|mailto:me@example.org]" =?>
+ para (link "mailto:me@example.org" "" "email")
+
+ , "attachment" =:
+ "[^example.txt]" =?>
+ para (linkWith ("", ["attachment"], []) "example.txt" "" "example.txt")
+
+ , "attachment with description" =:
+ "[an example^example.txt]" =?>
+ para (linkWith ("", ["attachment"], []) "example.txt" "" "an example")
+
+ , "user" =:
+ "[~johndoe]" =?>
+ para (linkWith ("", ["user-account"], []) "~johndoe" "" "~johndoe")
+
+ , "user with description" =:
+ "[John Doe|~johndoe]" =?>
+ para (linkWith ("", ["user-account"], []) "~johndoe" "" "John Doe")
+ ]
, "image" =:
"!https://example.com/image.jpg!" =?>
diff --git a/test/Tests/Writers/Jira.hs b/test/Tests/Writers/Jira.hs
index 48626487e..57ed27360 100644
--- a/test/Tests/Writers/Jira.hs
+++ b/test/Tests/Writers/Jira.hs
@@ -28,5 +28,39 @@ tests =
imageWith ("", [], [("align", "right"), ("height", "50")])
"image.png" "" mempty =?>
"!image.png|align=right, height=50!"
+
+ , testGroup "links"
+ [ "external link" =:
+ link "https://example.com/test.php" "" "test" =?>
+ "[test|https://example.com/test.php]"
+
+ , "external link without description" =:
+ link "https://example.com/tmp.js" "" "https://example.com/tmp.js" =?>
+ "[https://example.com/tmp.js]"
+
+ , "email link" =:
+ link "mailto:me@example.com" "" "Jane" =?>
+ "[Jane|mailto:me@example.com]"
+
+ , "email link without description" =:
+ link "mailto:me@example.com" "" "me@example.com" =?>
+ "[mailto:me@example.com]"
+
+ , "attachment link" =:
+ linkWith ("", ["attachment"], []) "foo.txt" "" "My file" =?>
+ "[My file^foo.txt]"
+
+ , "attachment link without description" =:
+ linkWith ("", ["attachment"], []) "foo.txt" "" "foo.txt" =?>
+ "[^foo.txt]"
+
+ , "user link" =:
+ linkWith ("", ["user-account"], []) "~johndoe" "" "John Doe" =?>
+ "[John Doe|~johndoe]"
+
+ , "user link with user as description" =:
+ linkWith ("", ["user-account"], []) "~johndoe" "" "~johndoe" =?>
+ "[~johndoe]"
+ ]
]
]