def (#12)
All checks were successful
Go Action / goaction (push) Successful in 29s

Reviewed-on: #12
This commit was merged in pull request #12.
This commit is contained in:
2025-12-26 14:55:42 +03:00
parent 22dacb741f
commit f9a0411192
129 changed files with 4660 additions and 1456 deletions

49
param/param_test.go Normal file
View File

@@ -0,0 +1,49 @@
package param_test
import (
"testing"
"gitoa.ru/go-4devs/config/param"
)
func TestChainReplace(t *testing.T) {
t.Parallel()
const (
replaceParam = "param1"
replaceValue = "replace"
)
params1 := param.With(param.New(), replaceParam, "param1")
params2 := param.With(param.New(), replaceParam, replaceValue)
data, ok := param.String(param.Chain(params1, params2), replaceParam)
if !ok {
t.Errorf("param %v: not found", replaceParam)
}
if data != replaceValue {
t.Errorf("got:%v, expect:%v", data, replaceValue)
}
}
func TestChainExtend(t *testing.T) {
t.Parallel()
const (
extendParam = "param1"
extendValue = "replace"
)
params1 := param.With(param.New(), extendParam, extendValue)
params2 := param.With(param.New(), "new_value", "param2")
data1, ok := param.String(param.Chain(params1, params2), extendParam)
if !ok {
t.Errorf("param %v: not found", extendParam)
}
if data1 != extendValue {
t.Errorf("got:%v, expect:%v", data1, extendParam)
}
}