package framework import ( "path/filepath" "testing" "github.com/stretchr/testify/assert" ) func TestCommaSeparatedValueParsing(t *testing.T) { tcs := map[string]struct { input string expected map[string]string }{ "typical": {"label1=foo,bar=2", map[string]string{"label1": "foo", "bar": "2"}}, "all-commas": {",,,", map[string]string{}}, "trailing-empty-comma": {"foo=bar,,", map[string]string{"foo": "bar"}}, "trailing-missing-value": {"foo=bar,k", map[string]string{"foo": "bar"}}, } for name, tc := range tcs { t.Run(name, func(t *testing.T) { assert.Equal(t, tc.expected, commaSepValues(tc.input)) }) } } func TestResolvePath(t *testing.T) { Context.RepoRoot = "/Users/swim/dev/ncr/edge-infra" assert.Equal(t, filepath.Join(Context.RepoRoot, "key.json"), ResolvePath("key.json")) Context.RepoRoot = "" assert.Panics(t, func() { ResolvePath("key.json") }) }