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