/****************************************************************************** __ ____ __ / / ___ ____ _/ __/_____________ _/ /__ / / / _ \/ __ `/ /_/ ___/ ___/ __ `/ / _ \ / /___/ __/ /_/ / __(__ ) /__/ /_/ / / __/ /_____/\___/\__,_/_/ /____/\___/\__,_/_/\___/ (C)opyright 2026, Leafscale, LLC - https://www.leafscale.com Project: repoman Filename: tests/test_profile_render.reef Authors: Chris Tusa License: Description: Tests: profile ${VAR} substitution at install time ******************************************************************************/ import profile import test.framework import core.str proc main() let runner = new framework.TestRunner() let host = profile.HostFacts { lan_ip: "192.168.168.124", user: "ctusa", home: "/home/ctusa" } // All three substitutions let yaml: string = "config:\n environment.OLLAMA_HOST: \"http://\${HOST_LAN_IP}:11434\"\ndevices:\n state:\n source: \${HOME}/.ollama\n user: \${USER}\n" let out = profile.render(yaml, host) runner.assert_contains_string(out, "http://192.168.168.124:11434", "\${HOST_LAN_IP} substituted") runner.assert_contains_string(out, "/home/ctusa/.ollama", "\${HOME} substituted") runner.assert_contains_string(out, "user: ctusa", "\${USER} substituted") runner.assert_eq_bool(false, str.contains(out, "\${HOST_LAN_IP}"), "no leftover \${HOST_LAN_IP}") runner.assert_eq_bool(false, str.contains(out, "\${USER}"), "no leftover \${USER}") runner.assert_eq_bool(false, str.contains(out, "\${HOME}"), "no leftover \${HOME}") // No substitutions present — input is returned unchanged let plain: string = "name: foo\nconfig: {}\n" runner.assert_eq_string(profile.render(plain, host), plain, "no-substitution input passes through") // Empty input runner.assert_eq_string(profile.render("", host), "", "empty input") runner.report() end main