1 ! Copyright (C) 2010 John Benediktsson
2 ! See http://factorcode.org/license.txt for BSD license
4 USING: ini-file tools.test ;
6 { H{ } } [ "" string>ini ] unit-test
8 { H{ { "section" H{ } } } } [ "[section]" string>ini ] unit-test
10 { H{ { "section" H{ } } } } [ "[\"section\" ]" string>ini ] unit-test
12 { H{ { " some name with spaces " H{ } } } }
13 [ "[ \" some name with spaces \"]" string>ini ] unit-test
15 { H{ { "[]" H{ } } } } [ "[\\[\\]]" string>ini ] unit-test
17 { H{ { "foo" "bar" } } } [ "foo=bar" string>ini ] unit-test
19 { H{ { "foo" "bar" } { "baz" "quz" } } }
20 [ "foo=bar\nbaz= quz" string>ini ] unit-test
22 { H{ { "section" H{ { "foo" "abc def" } } } } }
30 { H{ { "section" H{ { "foo" "abc def" } } } } }
39 { H{ { "section" H{ { "foo" "abc def" } } } } }
48 { H{ { "section" H{ { "foo" "abc def" } } } } }
51 [section] foo = \"abc def\"
55 { H{ { "section" H{ { "foo" "abc def" } } } } }
58 [section] foo = abc \\
63 { H{ { "section" H{ { "foo" "" } } } } }
71 { H{ { "section" H{ { "foo" "" } } } } }
79 { H{ { "" H{ { "" "" } } } } }
87 { H{ { "owner" H{ { "name" "John Doe" }
88 { "organization" "Acme Widgets Inc." } } }
89 { "database" H{ { "server" "192.0.2.62" }
91 { "file" "payroll.dat" } } } } }
94 ; last modified 1 April 2001 by John Doe
97 organization=Acme Widgets Inc.
100 server=192.0.2.62 ; use IP address in case network name resolution is not working
102 file = \"payroll.dat\"
106 { H{ { "a long section name"
107 H{ { "a long key name" "a long value name" } } } } }
110 [a long section name ]
111 a long key name= a long value name
115 { H{ { "key with \n esc\ape \r codes \""
116 "value with \t esc\ape codes" } } }
119 key with \\n esc\\ape \\r codes \\\" = value with \\t esc\\ape codes
124 { "key with \\n esc\\ape \\r codes \\\"=value with \\t esc\\ape codes\n" }
126 H{ { "key with \n esc\ape \r codes \""
127 "value with \t esc\ape codes" } } ini>string