diff options
Diffstat (limited to 'test/testdata/eval-okay-fromTOML.nix')
-rw-r--r-- | test/testdata/eval-okay-fromTOML.nix | 208 |
1 files changed, 208 insertions, 0 deletions
diff --git a/test/testdata/eval-okay-fromTOML.nix b/test/testdata/eval-okay-fromTOML.nix new file mode 100644 index 0000000..9639326 --- /dev/null +++ b/test/testdata/eval-okay-fromTOML.nix | |||
@@ -0,0 +1,208 @@ | |||
1 | [ | ||
2 | |||
3 | (builtins.fromTOML '' | ||
4 | # This is a TOML document. | ||
5 | |||
6 | title = "TOML Example" | ||
7 | |||
8 | [owner] | ||
9 | name = "Tom Preston-Werner" | ||
10 | #dob = 1979-05-27T07:32:00-08:00 # First class dates | ||
11 | |||
12 | [database] | ||
13 | server = "192.168.1.1" | ||
14 | ports = [ 8001, 8001, 8002 ] | ||
15 | connection_max = 5000 | ||
16 | enabled = true | ||
17 | |||
18 | [servers] | ||
19 | |||
20 | # Indentation (tabs and/or spaces) is allowed but not required | ||
21 | [servers.alpha] | ||
22 | ip = "10.0.0.1" | ||
23 | dc = "eqdc10" | ||
24 | |||
25 | [servers.beta] | ||
26 | ip = "10.0.0.2" | ||
27 | dc = "eqdc10" | ||
28 | |||
29 | [clients] | ||
30 | data = [ ["gamma", "delta"], [1, 2] ] | ||
31 | |||
32 | # Line breaks are OK when inside arrays | ||
33 | hosts = [ | ||
34 | "alpha", | ||
35 | "omega" | ||
36 | ] | ||
37 | '') | ||
38 | |||
39 | (builtins.fromTOML '' | ||
40 | key = "value" | ||
41 | bare_key = "value" | ||
42 | bare-key = "value" | ||
43 | 1234 = "value" | ||
44 | |||
45 | "127.0.0.1" = "value" | ||
46 | "character encoding" = "value" | ||
47 | "ʎǝʞ" = "value" | ||
48 | 'key2' = "value" | ||
49 | 'quoted "value"' = "value" | ||
50 | |||
51 | name = "Orange" | ||
52 | |||
53 | physical.color = "orange" | ||
54 | physical.shape = "round" | ||
55 | site."google.com" = true | ||
56 | |||
57 | # This is legal according to the spec, but cpptoml doesn't handle it. | ||
58 | #a.b.c = 1 | ||
59 | #a.d = 2 | ||
60 | |||
61 | str = "I'm a string. \"You can quote me\". Name\tJos\u00E9\nLocation\tSF." | ||
62 | |||
63 | int1 = +99 | ||
64 | int2 = 42 | ||
65 | int3 = 0 | ||
66 | int4 = -17 | ||
67 | int5 = 1_000 | ||
68 | int6 = 5_349_221 | ||
69 | int7 = 1_2_3_4_5 | ||
70 | |||
71 | hex1 = 0xDEADBEEF | ||
72 | hex2 = 0xdeadbeef | ||
73 | hex3 = 0xdead_beef | ||
74 | |||
75 | oct1 = 0o01234567 | ||
76 | oct2 = 0o755 | ||
77 | |||
78 | bin1 = 0b11010110 | ||
79 | |||
80 | flt1 = +1.0 | ||
81 | flt2 = 3.1415 | ||
82 | flt3 = -0.01 | ||
83 | flt4 = 5e+22 | ||
84 | flt5 = 1e6 | ||
85 | flt6 = -2E-2 | ||
86 | flt7 = 6.626e-34 | ||
87 | flt8 = 9_224_617.445_991_228_313 | ||
88 | |||
89 | bool1 = true | ||
90 | bool2 = false | ||
91 | |||
92 | # FIXME: not supported because Nix doesn't have a date/time type. | ||
93 | #odt1 = 1979-05-27T07:32:00Z | ||
94 | #odt2 = 1979-05-27T00:32:00-07:00 | ||
95 | #odt3 = 1979-05-27T00:32:00.999999-07:00 | ||
96 | #odt4 = 1979-05-27 07:32:00Z | ||
97 | #ldt1 = 1979-05-27T07:32:00 | ||
98 | #ldt2 = 1979-05-27T00:32:00.999999 | ||
99 | #ld1 = 1979-05-27 | ||
100 | #lt1 = 07:32:00 | ||
101 | #lt2 = 00:32:00.999999 | ||
102 | |||
103 | arr1 = [ 1, 2, 3 ] | ||
104 | arr2 = [ "red", "yellow", "green" ] | ||
105 | arr3 = [ [ 1, 2 ], [3, 4, 5] ] | ||
106 | arr4 = [ "all", 'strings', """are the same""", ''''type''''] | ||
107 | arr5 = [ [ 1, 2 ], ["a", "b", "c"] ] | ||
108 | |||
109 | arr7 = [ | ||
110 | 1, 2, 3 | ||
111 | ] | ||
112 | |||
113 | arr8 = [ | ||
114 | 1, | ||
115 | 2, # this is ok | ||
116 | ] | ||
117 | |||
118 | [table-1] | ||
119 | key1 = "some string" | ||
120 | key2 = 123 | ||
121 | |||
122 | |||
123 | [table-2] | ||
124 | key1 = "another string" | ||
125 | key2 = 456 | ||
126 | |||
127 | [dog."tater.man"] | ||
128 | type.name = "pug" | ||
129 | |||
130 | [a.b.c] | ||
131 | [ d.e.f ] | ||
132 | [ g . h . i ] | ||
133 | [ j . "ʞ" . 'l' ] | ||
134 | [x.y.z.w] | ||
135 | |||
136 | name = { first = "Tom", last = "Preston-Werner" } | ||
137 | point = { x = 1, y = 2 } | ||
138 | animal = { type.name = "pug" } | ||
139 | |||
140 | [[products]] | ||
141 | name = "Hammer" | ||
142 | sku = 738594937 | ||
143 | |||
144 | [[products]] | ||
145 | |||
146 | [[products]] | ||
147 | name = "Nail" | ||
148 | sku = 284758393 | ||
149 | color = "gray" | ||
150 | |||
151 | [[fruit]] | ||
152 | name = "apple" | ||
153 | |||
154 | [fruit.physical] | ||
155 | color = "red" | ||
156 | shape = "round" | ||
157 | |||
158 | [[fruit.variety]] | ||
159 | name = "red delicious" | ||
160 | |||
161 | [[fruit.variety]] | ||
162 | name = "granny smith" | ||
163 | |||
164 | [[fruit]] | ||
165 | name = "banana" | ||
166 | |||
167 | [[fruit.variety]] | ||
168 | name = "plantain" | ||
169 | '') | ||
170 | |||
171 | (builtins.fromTOML '' | ||
172 | [[package]] | ||
173 | name = "aho-corasick" | ||
174 | version = "0.6.4" | ||
175 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
176 | dependencies = [ | ||
177 | "memchr 2.0.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
178 | ] | ||
179 | |||
180 | [[package]] | ||
181 | name = "ansi_term" | ||
182 | version = "0.9.0" | ||
183 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
184 | |||
185 | [[package]] | ||
186 | name = "atty" | ||
187 | version = "0.2.10" | ||
188 | source = "registry+https://github.com/rust-lang/crates.io-index" | ||
189 | dependencies = [ | ||
190 | "libc 0.2.42 (registry+https://github.com/rust-lang/crates.io-index)", | ||
191 | "termion 1.5.1 (registry+https://github.com/rust-lang/crates.io-index)", | ||
192 | "winapi 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", | ||
193 | ] | ||
194 | |||
195 | [metadata] | ||
196 | "checksum aho-corasick 0.6.4 (registry+https://github.com/rust-lang/crates.io-index)" = "d6531d44de723825aa81398a6415283229725a00fa30713812ab9323faa82fc4" | ||
197 | "checksum ansi_term 0.11.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ee49baf6cb617b853aa8d93bf420db2383fab46d314482ca2803b40d5fde979b" | ||
198 | "checksum ansi_term 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "23ac7c30002a5accbf7e8987d0632fa6de155b7c3d39d0067317a391e00a2ef6" | ||
199 | "checksum arrayvec 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a1e964f9e24d588183fcb43503abda40d288c8657dfc27311516ce2f05675aef" | ||
200 | '') | ||
201 | |||
202 | (builtins.fromTOML '' | ||
203 | a = [[{ b = true }]] | ||
204 | c = [ [ { d = true } ] ] | ||
205 | e = [[123]] | ||
206 | '') | ||
207 | |||
208 | ] | ||