source: project/release/4/fancypants/tests/run.scm @ 15547

Last change on this file since 15547 was 15547, checked in by sjamaan, 10 years ago

Port fancypants to Chicken 4

File size: 3.4 KB
Line 
1(require-extension test sxml-transforms)
2
3(load "../fancypants.scm")
4(import fancypants)
5
6(test-group "fancification"
7  (test-group "ligatures"
8    (test '("Delicious wa" (& "#xfb04") "es")
9          (fancify "Delicious waffles" default-ligature-map))
10    (test '("Ye olde bu" (& "#xfb00") " coat")
11          (fancify "Ye olde buff coat" default-ligature-map))
12    (test '("Can you " (& "#xfb02") "y away?")
13          (fancify "Can you fly away?" default-ligature-map))
14    (test '("Fly, you fools!")
15          (fancify "Fly, you fools!" default-ligature-map)))
16  (test-group "arrows"
17    (test '("number" (& "#x2192") "string")
18          (fancify "number->string" default-arrow-map))
19    (test '("Does " (& "#x2194") " look like a space ship?")
20          (fancify "Does <-> look like a space ship?" default-arrow-map))))
21
22;; FIXME: The distribution of *flatten* and empty strings is too
23;; dependent on the algorithm that is being used.
24(test-group "quote education"
25  (test '(p (*flatten* "Fatboy Slim is the band of the " (& "#x2019") "90s" "!"))
26        (smarten-quotes '(p "Fatboy Slim is the band of the '90s!")))
27  (test '(p (*flatten* "What" (& "#x2019") "s" " that?"))
28        (smarten-quotes '(p "What's that?")))
29  (test '(p (*flatten* "" (& "#x201c") "" "We" (& "#x2019") "re" " going to need a bigger boat" (& "#x201d") "" ", he said"))
30        (smarten-quotes '(p "\"We're going to need a bigger boat\", he said")))
31  (test '(p (*flatten* "" (& "#x2018") "" "We" (& "#x2019") "re" " going to need a bigger boat" (& "#x2019") "" ", he said"))
32        (smarten-quotes '(p "'We're going to need a bigger boat', he said")))
33  (test '(p (*flatten* "" (& "#x2018") "" "One" (& "#x2019") "" " or " (& "#x2018") "" "Two" (& "#x2019") "" "?"))
34        (smarten-quotes '(p "'One' or 'Two'?")))
35  (test '(p (*flatten* "" (& "#x201c") "" "One" (& "#x201d") "" " or " (& "#x201c") "" "Two" (& "#x201d") "" "?"))
36        (smarten-quotes '(p "\"One\" or \"Two\"?")))
37  (test '(p (*flatten* "" (& "#x201c") "" "There" (& "#x2019") "s" " ") (em (*flatten* "no")) (*flatten* " business like show business" (& "#x201d") "" ""))
38        (smarten-quotes
39         '(p "\"There's " (em "no") " business like show business\"")))
40  (test '(p (*flatten* "" (& "#x201c") "" "Hi there" (& "#x201d") "" ", he said"))
41        (smarten-quotes '(p "``Hi there'', he said")))
42  (test '(p (*flatten* "" (& "#x201c") "" "" (& "#x201c") "" "Hi there" (& "#x201d") "" ", he said" (& "#x201d") "" ", I said"))
43        (smarten-quotes '(p "````Hi there'', he said'', I said")))
44  (test '(p (*flatten* "" (& "#x201c") "" "" (& "#x201c") "" "Hi there" (& "#x201d") "" ", he said" (& "#x201d") "" ", I said"))
45        (smarten-quotes '(p "\"``Hi there'', he said\", I said")))
46  )
47
48(test-group "sxml rulesets"
49  (test '(p "The procedure " (& "#x201c") "number" (& "#x2192") "string" (& "#x201d") " changes numbers into strings")
50        (pre-post-order
51         (pre-post-order
52          '(p "The procedure \"number->string\" changes numbers into strings")
53          (make-smart-quote-rules))
54         (make-fancy-rules)))
55  (test '(p "The procedure " (& "#x201c")
56            (code "number->string")
57            (& "#x201d") " changes numbers into strings")
58        (pre-post-order
59         (pre-post-order
60          '(p "The procedure \""
61              (code "number->string")
62              "\" changes numbers into strings")
63          (make-smart-quote-rules))
64         (make-fancy-rules))))
Note: See TracBrowser for help on using the repository browser.