/****************************************************************************** __ ____ __ / / ___ ____ _/ __/_____________ _/ /__ / / / _ \/ __ `/ /_/ ___/ ___/ __ `/ / _ \ / /___/ __/ /_/ / __(__ ) /__/ /_/ / / __/ /_____/\___/\__,_/_/ /____/\___/\__,_/_/\___/ (C)opyright 2026, Leafscale, LLC - https://www.leafscale.com Project: repoman Filename: tests/test_config_override.reef Authors: Chris Tusa License: Description: Tests: per-project override parsing and application ******************************************************************************/ import config import test.framework import core.result_generic as rg proc main() let runner = new framework.TestRunner() let toml_input: string = "[container]\nimage = \"images:debian/12/cloud\"\nprofiles = [\"default\", \"claude-share\", \"node-dev\"]\n\n[[mount]]\nsource = \"~/.npm\"\npath = \"/home/ctusa/.npm\"\n\n[[mount]]\nsource = \"~/.cache/yarn\"\npath = \"/home/ctusa/.cache/yarn\"\n\n[env]\nNODE_ENV = \"development\"\nDEBUG = \"1\"\n" let r = config.parse_override(toml_input) runner.assert_eq_bool(rg.is_ok(r), true, "override parse succeeds") if rg.is_ok(r) let ov = rg.unwrap_ok(r) runner.assert_eq_string(ov.image, "images:debian/12/cloud", "override.image") runner.assert_eq_bool(ov.has_profiles, true, "has_profiles set") runner.assert_eq_int(ov.profiles.length(), 3, "profiles count") runner.assert_eq_string(ov.profiles[2], "node-dev", "profiles[2]") runner.assert_eq_int(ov.mounts.length(), 2, "mount count") runner.assert_eq_string(ov.mounts[0].source, "~/.npm", "mount[0].source") runner.assert_eq_string(ov.mounts[0].path, "/home/ctusa/.npm", "mount[0].path") runner.assert_eq_int(ov.env_keys.length(), 2, "env count") // env keys are not order-guaranteed by TOML; check both possibilities let k0: string = ov.env_keys[0] runner.assert_eq_bool(k0 == "NODE_ENV" or k0 == "DEBUG", true, "env_keys[0] is one of expected") end if // empty override let r2 = config.parse_override("") runner.assert_eq_bool(rg.is_ok(r2), true, "empty override is valid") if rg.is_ok(r2) let ov2 = rg.unwrap_ok(r2) runner.assert_eq_string(ov2.image, "", "empty override.image") runner.assert_eq_bool(ov2.has_profiles, false, "no profiles") runner.assert_eq_int(ov2.mounts.length(), 0, "no mounts") runner.assert_eq_int(ov2.env_keys.length(), 0, "no env") end if runner.report() end main