From 6ea6011ca66c3127ff42cd5d0d39b3bd40e56e76 Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Thu, 30 Aug 2018 17:10:46 +0300 Subject: Muse writer: use lightweight markup when possible --- test/Tests/Writers/Muse.hs | 50 ++++++++++++++++++++++++++++++++++++---------- 1 file changed, 39 insertions(+), 11 deletions(-) (limited to 'test/Tests') diff --git a/test/Tests/Writers/Muse.hs b/test/Tests/Writers/Muse.hs index 50c0e78eb..f44097f9e 100644 --- a/test/Tests/Writers/Muse.hs +++ b/test/Tests/Writers/Muse.hs @@ -354,23 +354,51 @@ tests = [ testGroup "block elements" , "do not escape ; inside paragraph" =: text "foo ; bar" =?> "foo ; bar" ] , testGroup "emphasis" - [ "emph" =: emph (text "foo") =?> "foo" - , "strong" =: strong (text "foo") =?> "foo" + [ "emphasis" =: emph (text "foo") =?> "*foo*" + , "emphasis inside word" =: text "foo" <> emph (text "bar") <> text "baz" =?> "foobarbaz" + , "emphasis before comma" =: emph (text "foo") <> text ", bar" =?> "*foo*, bar" + , "emphasis before period" =: emph (text "foobar") <> text "." =?> "*foobar*." + , "empty emphasis" =: emph mempty =?> "" + , "empty strong" =: strong mempty =?> "" + , "empty strong emphasis" =: strong (emph mempty) =?> "****" + , "empty emphasized strong" =: emph (strong mempty) =?> "**" + , "strong" =: strong (text "foo") =?> "**foo**" + , "strong inside word" =: text "foo" <> strong (text "bar") <> text "baz" =?> "foobarbaz" + , "strong emphasis" =: strong (emph (text "foo")) =?> "***foo***" + , "strong after emphasis" =: emph (text "foo") <> strong (text "bar") =?> "*foo*bar" + , "strong emphasis after emphasis" =: emph (text "foo") <> strong (emph (text "bar")) =?> "*foo**bar*" + , "strong in the end of emphasis" =: emph (text "foo" <> strong (text "bar")) =?> "*foobar*" , "strikeout" =: strikeout (text "foo") =?> "foo" + , "space at the beginning of emphasis" =: emph (text " foo") =?> " foo" + , "space at the end of emphasis" =: emph (text "foo ") =?> "foo " + , "space at the beginning of strong" =: strong (text " foo") =?> " foo" + , "space at the end of strong" =: strong (text "foo ") =?> "foo " + , "space at the beginning of strong emphasis" =: strong (emph (text " foo")) =?> "** foo**" + , "space at the end of strong emphasis" =: strong (emph (text "foo ")) =?> "**foo **" + , "space at the beginning of emphasiszed strong" =: emph (strong (text " foo")) =?> "* foo*" + , "space at the end of emphasized strong" =: emph (strong (text "foo ")) =?> "*foo *" ] , "superscript" =: superscript (text "foo") =?> "foo" , "subscript" =: subscript (text "foo") =?> "foo" - , "smallcaps" =: smallcaps (text "foo") =?> "foo" - , "smallcaps near emphasis" =: emph (str "foo") <> smallcaps (str "bar") =?> "foobar" + , "smallcaps" =: smallcaps (text "foo") =?> "*foo*" + , "smallcaps near emphasis" =: emph (str "foo") <> smallcaps (str "bar") =?> "*foobar*" , "single quoted" =: singleQuoted (text "foo") =?> "‘foo’" , "double quoted" =: doubleQuoted (text "foo") =?> "“foo”" -- Cite is trivial , testGroup "code" - [ "simple" =: code "foo" =?> "foo" + [ "simple" =: code "foo" =?> "=foo=" + , "empty" =: code "" =?> "" + , "space" =: code " " =?> " " + , "space at the beginning" =: code " foo" =?> " foo" + , "space at the end" =: code "foo " =?> "foo " + , "use tags for =" =: code "foo = bar" =?> "foo = bar" , "escape tag" =: code "foo = bar baz" =?> "foo = bar</code> baz" - , "normalization with attributes" =: codeWith ("",["haskell"],[]) "foo" <> code "bar" =?> "foobar" - , "normalization" =: code " code "de>" =?> "</code>" - , "normalization with empty string" =: code " str "" <> code "de>" =?> "</code>" + , "normalization with attributes" =: codeWith ("",["haskell"],[]) "foo" <> code "bar" =?> "=foobar=" + , "code tag" =: code "foo" =?> "=foo=" + , "normalization" =: code " code "de>" <> code "=" =?> "</code>=" + , "normalization with empty string" =: code " str "" <> code "de>" <> code "=" =?> "</code>=" + , "emphasized code" =: emph (code "foo") =?> "*=foo=*" + , "strong code" =: strong (code "foo") =?> "**=foo=**" ] , testGroup "spaces" [ "space" =: text "a" <> space <> text "b" =?> "a b" @@ -385,7 +413,7 @@ tests = [ testGroup "block elements" , testGroup "math" [ "inline math" =: math "2^3" =?> "23" , "display math" =: displayMath "2^3" =?> "23" - , "multiple letters in inline math" =: math "abc" =?> "abc" + , "multiple letters in inline math" =: math "abc" =?> "*abc*" , "expand math before normalization" =: math "[" <> str "2]" =?> "[2]" , "multiple math expressions inside one inline list" =: math "5_4" <> text ", " <> displayMath "3^2" =?> "54, 32" ] @@ -461,7 +489,7 @@ tests = [ testGroup "block elements" "foobar" , "emph quoted" =: para (doubleQuoted (emph (text "foo"))) =?> - "“foo”" + "“*foo*”" , "strong word before" =: para (text "foo" <> strong (text "bar")) =?> "foobar" @@ -470,7 +498,7 @@ tests = [ testGroup "block elements" "foobar" , "strong quoted" =: para (singleQuoted (strong (text "foo"))) =?> - "‘foo’" + "‘**foo**’" ] ] ] -- cgit v1.2.3