]> gitweb.factorcode.org Git - factor.git/blob - extra/txon/txon-tests.factor
6d294c741963ad4f43c0e6f1a1cff814c4bdffa2
[factor.git] / extra / txon / txon-tests.factor
1
2 USING: tools.test txon ;
3
4 IN: txon.tests
5
6 [ "ABC" ] [ "ABC" >txon ] unit-test
7
8 [ "A\\`C" ] [ "A`C" >txon ] unit-test
9
10 [ "123" ] [ 123 >txon ] unit-test
11
12 [ "1\n2\n3" ] [ { 1 2 3 } >txon ] unit-test
13
14 [ "a:`123`\nb:`456`" ] [ H{ { "a" 123 } { "b" 456 } } >txon ] unit-test
15
16 [ "foo" ] [ "foo" txon> ] unit-test
17
18 [ "foo" ] [ "   foo   " txon> ] unit-test
19
20 [ H{ { "foo" "" } } ]
21 [ "foo:``" txon> ] unit-test
22
23 [ H{ { "foo" " " } } ]
24 [ "foo:` `" txon> ] unit-test
25
26 [ H{ { "name" "value" } } ]
27 [ "name:`value`" txon> ] unit-test
28
29 [ H{ { "name" "value" } } ]
30 [ "  name:`value`  " txon> ] unit-test
31
32 [ H{ { "foo`bar" "value" } } ]
33 [ "foo\\`bar:`value`" txon> ] unit-test
34
35 [ H{ { "foo" "bar`baz" } } ]
36 [ "foo:`bar\\`baz`" txon> ] unit-test
37
38 [ { H{ { "name1" "value1" } } H{ { "name2" "value2" } } } ]
39 [ "name1:`value1`name2:`value2`" txon> ] unit-test
40
41 [ H{ { "name1" H{ { "name2" "nested value" } } } } ]
42 [ "name1:`  name2:`nested value` `" txon> ] unit-test
43
44 [ "name1:`name2:`nested value``" ]
45 [
46     H{ { "name1" H{ { "name2" "nested value" } } } } >txon
47 ] unit-test
48
49 [
50     H{
51         { "name1" H{ { "name2" "value2" } { "name3" "value3" } } }
52     }
53 ] [
54     "
55     name1:`
56         name2:`value2`
57         name3:`value3`
58     `
59     " txon>
60 ] unit-test
61
62 [
63     H{
64         { "name1" H{ { "name2" H{ { "name3" "value3" } } } } }
65     }
66 ] [
67     "
68     name1:`
69         name2:`
70             name3:`value3`
71         `
72     `
73     " txon>
74 ] unit-test
75
76 [ H{ { "a" { "1" "2" "3" } } } ] [ "a:`1\n2\n3`" txon> ] unit-test