]> gitweb.factorcode.org Git - factor.git/blob - basis/html/parser/parser-tests.factor
Merge branch 'master' of git://factorcode.org/git/factor
[factor.git] / basis / html / parser / parser-tests.factor
1 USING: html.parser kernel tools.test ;
2 IN: html.parser.tests
3
4 [
5     V{ T{ tag f "html" H{ } f f } }
6 ] [ "<html>" parse-html ] unit-test
7
8 [
9     V{ T{ tag f "html" H{ } f t } }
10 ] [ "</html>" parse-html ] unit-test
11
12 [
13     V{ T{ tag f "a" H{ { "href" "http://factorcode.org/" } } f f } }
14 ] [ "<a href=\"http://factorcode.org/\">" parse-html ] unit-test
15
16 [
17     V{ T{ tag f "a" H{ { "href" "http://factorcode.org/" } } f f } }
18 ] [ "<a   href  =  \"http://factorcode.org/\"   >" parse-html ] unit-test
19
20 [
21 V{
22     T{
23         tag
24         f
25         "a"
26         H{ { "baz" "\"quux\"" } { "foo" "bar's" } }
27         f
28         f
29     }
30 }
31 ] [ "<a   foo=\"bar's\" baz='\"quux\"'  >" parse-html ] unit-test
32
33 [
34 V{
35     T{ tag f "a"
36         H{
37             { "a" "pirsqd" }
38             { "foo" "bar" }
39             { "href" "http://factorcode.org/" }
40             { "baz" "quux" }
41         } f f }
42 }
43 ] [ "<a   href  =    \"http://factorcode.org/\"    foo   =  bar baz='quux'a=pirsqd  >" parse-html ] unit-test
44
45 [
46 V{
47     T{ tag f "html" H{ } f f }
48     T{ tag f "head" H{ } f f }
49     T{ tag f "head" H{ } f t }
50     T{ tag f "html" H{ } f t }
51 }
52 ] [ "<html<head</head</html" parse-html ] unit-test
53
54 [
55 V{
56     T{ tag f "head" H{ } f f }
57     T{ tag f "title" H{ } f f }
58     T{ tag f text f "Spagna" f }
59     T{ tag f "title" H{ } f t }
60     T{ tag f "head" H{ } f t }
61 }
62 ] [ "<head<title>Spagna</title></head" parse-html ] unit-test