1import { assert, describe, it } from "@effect/vitest"
2import * as Ini from "effect/encoding/Ini"
3
4describe("Ini", () => {
5 it("parses sections, arrays, and scalar values", () => {
6 assert.deepStrictEqual(
7 Ini.parse(`
8enabled=true
9missing=null
10name=effect
11tag[]=one
12tag[]=two
13
14[database.pool]
15size=10
16`),
17 {
18 enabled: true,
19 missing: null,
20 name: "effect",
21 tag: ["one", "two"],
22 database: {
23 pool: {
24 size: "10"
25 }
26 }
27 }
28 )
29 })
30
31 it("supports quoted values, comments, and escaped section dots", () => {
32 assert.deepStrictEqual(
33 Ini.parse(`
34plain=value ; comment
35quoted="value # retained"
36[a\\.b]
37key=yes
38`),
39 {
40 plain: "value",
41 quoted: "value # retained",
42 "a.b": {
43 key: "yes"
44 }
45 }
46 )
47 })
48})