1 ! Copyright (C) 2010 John Benediktsson
2 ! See http://factorcode.org/license.txt for BSD license
4 USING: ini-file tools.test ;
8 [ H{ } ] [ "" string>ini ] unit-test
10 [ H{ { "section" H{ } } } ] [ "[section]" string>ini ] unit-test
12 [ H{ { "section" H{ } } } ] [ "[\"section\" ]" string>ini ] unit-test
14 [ H{ { " some name with spaces " H{ } } } ]
15 [ "[ \" some name with spaces \"]" string>ini ] unit-test
17 [ H{ { "[]" H{ } } } ] [ "[\\[\\]]" string>ini ] unit-test
19 [ H{ { "foo" "bar" } } ] [ "foo=bar" string>ini ] unit-test
21 [ H{ { "foo" "bar" } { "baz" "quz" } } ]
22 [ "foo=bar\nbaz= quz" string>ini ] unit-test
24 [ H{ { "section" H{ { "foo" "abc def" } } } } ]
32 [ H{ { "section" H{ { "foo" "abc def" } } } } ]
41 [ H{ { "section" H{ { "foo" "abc def" } } } } ]
50 [ H{ { "section" H{ { "foo" "abc def" } } } } ]
53 [section] foo = "abc def"
57 [ H{ { "section" H{ { "foo" "abc def" } } } } ]
60 [section] foo = abc \\
65 [ H{ { "section" H{ { "foo" "" } } } } ]
73 [ H{ { "section" H{ { "foo" "" } } } } ]
81 [ H{ { "" H{ { "" "" } } } } ]
89 [ H{ { "owner" H{ { "name" "John Doe" }
90 { "organization" "Acme Widgets Inc." } } }
91 { "database" H{ { "server" "192.0.2.62" }
93 { "file" "payroll.dat" } } } } ]
96 ; last modified 1 April 2001 by John Doe
99 organization=Acme Widgets Inc.
102 server=192.0.2.62 ; use IP address in case network name resolution is not working
108 [ H{ { "a long section name"
109 H{ { "a long key name" "a long value name" } } } } ]
112 [a long section name ]
113 a long key name= a long value name
117 [ H{ { "key with \n esc\ape \r codes \""
118 "value with \t esc\ape codes" } } ]
121 key with \\n esc\\ape \\r codes \\\" = value with \\t esc\\ape codes
126 [ """key with \\n esc\\ape \\r codes \\\"=value with \\t esc\\ape codes\n""" ]
128 H{ { "key with \n esc\ape \r codes \""
129 "value with \t esc\ape codes" } } ini>string