(require-extension test sxml-transforms) (use fancypants) (test-group "fancification" (test-group "ligatures" (test '("Delicious wa" (& "#xfb04") "es") (fancify "Delicious waffles" default-ligature-map)) (test '("Ye olde bu" (& "#xfb00") " coat") (fancify "Ye olde buff coat" default-ligature-map)) (test '("Can you " (& "#xfb02") "y away?") (fancify "Can you fly away?" default-ligature-map)) (test '("Fly, you fools!") (fancify "Fly, you fools!" default-ligature-map))) (test-group "arrows" (test '("number" (& "#x2192") "string") (fancify "number->string" default-arrow-map)) (test '("Does " (& "#x2194") " look like a space ship?") (fancify "Does <-> look like a space ship?" default-arrow-map)))) ;; FIXME: The distribution of *flatten* and empty strings is too ;; dependent on the algorithm that is being used. (test-group "quote education" (test '(p (*flatten* "Fatboy Slim is the band of the " (& "#x2019") "90s" "!")) (smarten-quotes '(p "Fatboy Slim is the band of the '90s!"))) (test '(p (*flatten* "What" (& "#x2019") "s" " that?")) (smarten-quotes '(p "What's that?"))) (test '(p (*flatten* "" (& "#x201c") "" "We" (& "#x2019") "re" " going to need a bigger boat" (& "#x201d") "" ", he said")) (smarten-quotes '(p "\"We're going to need a bigger boat\", he said"))) (test '(p (*flatten* "" (& "#x2018") "" "We" (& "#x2019") "re" " going to need a bigger boat" (& "#x2019") "" ", he said")) (smarten-quotes '(p "'We're going to need a bigger boat', he said"))) (test '(p (*flatten* "" (& "#x2018") "" "One" (& "#x2019") "" " or " (& "#x2018") "" "Two" (& "#x2019") "" "?")) (smarten-quotes '(p "'One' or 'Two'?"))) (test '(p (*flatten* "" (& "#x201c") "" "One" (& "#x201d") "" " or " (& "#x201c") "" "Two" (& "#x201d") "" "?")) (smarten-quotes '(p "\"One\" or \"Two\"?"))) (test '(p (*flatten* "" (& "#x201c") "" "There" (& "#x2019") "s" " ") (em (*flatten* "no")) (*flatten* " business like show business" (& "#x201d") "" "")) (smarten-quotes '(p "\"There's " (em "no") " business like show business\""))) (test '(p (*flatten* "" (& "#x201c") "" "Hi there" (& "#x201d") "" ", he said")) (smarten-quotes '(p "``Hi there'', he said"))) (test '(p (*flatten* "" (& "#x201c") "" "" (& "#x201c") "" "Hi there" (& "#x201d") "" ", he said" (& "#x201d") "" ", I said")) (smarten-quotes '(p "````Hi there'', he said'', I said"))) (test '(p (*flatten* "" (& "#x201c") "" "" (& "#x201c") "" "Hi there" (& "#x201d") "" ", he said" (& "#x201d") "" ", I said")) (smarten-quotes '(p "\"``Hi there'', he said\", I said"))) ) (test-group "sxml rulesets" (test '(p "The procedure " (& "#x201c") "number" (& "#x2192") "string" (& "#x201d") " changes numbers into strings") (pre-post-order (pre-post-order '(p "The procedure \"number->string\" changes numbers into strings") (make-smart-quote-rules)) (make-fancy-rules))) (test '(p "The procedure " (& "#x201c") (code "number->string") (& "#x201d") " changes numbers into strings") (pre-post-order (pre-post-order '(p "The procedure \"" (code "number->string") "\" changes numbers into strings") (make-smart-quote-rules)) (make-fancy-rules))))