1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
|
/******************************************************************************
__ ____ __
/ / ___ ____ _/ __/_____________ _/ /__
/ / / _ \/ __ `/ /_/ ___/ ___/ __ `/ / _ \
/ /___/ __/ /_/ / __(__ ) /__/ /_/ / / __/
/_____/\___/\__,_/_/ /____/\___/\__,_/_/\___/
(C)opyright 2026, Leafscale, LLC - https://www.leafscale.com
Project: repoman
Filename: tests/test_config_schema_v3.reef
Authors: Chris Tusa <chris.tusa@leafscale.com>
License: <see LICENSE file included with this source code>
Description: Tests: schema 3 ([host].lan_ip) parse/serialize
******************************************************************************/
import config
import test.framework
import core.result_generic as rg
import core.str
proc main()
let runner = new framework.TestRunner()
// Build a schema-3 registry, serialize, parse round-trip
let reg = config.Registry {
schema: 3,
host: config.Host { lan_ip: "192.168.168.124" },
output: "quiet",
defaults: config.Defaults {
repos_root: "~/repos",
backup_root: "/nfs/repos",
logdir: "~/.local/state/repoman",
incus_project: "repoman",
default_image: "images:ubuntu/26.04/cloud",
profiles: ["default"]
},
projects: new [config.Project](0)
}
let s = config.serialize_registry(reg)
runner.assert_contains_string(s, "schema = 3", "writes schema = 3")
runner.assert_contains_string(s, "[host]", "writes [host] block")
runner.assert_contains_string(s, "lan_ip = \"192.168.168.124\"", "writes lan_ip")
let neg = str.contains(s, "[defaults.llm]")
runner.assert_eq_bool(neg, false, "does NOT write [defaults.llm]")
let r2 = config.parse_registry(s)
runner.assert_eq_bool(rg.is_ok(r2), true, "round-trip parses ok")
if rg.is_ok(r2)
let reg2 = rg.unwrap_ok(r2)
runner.assert_eq_int(reg2.schema, 3, "round-trip schema = 3")
runner.assert_eq_string(reg2.host.lan_ip, "192.168.168.124", "round-trip host.lan_ip")
end if
runner.report()
end main
|