aboutsummaryrefslogtreecommitdiffstats
path: root/modules/templates/util_test.go
Commit message (Collapse)AuthorAgeFilesLines
* Improve template helper functions: string/slice (#24266)wxiaoguang2023-04-221-0/+36
| | | | | | | | | | | | | | | | | | | | | | | Follow #23328 The improvements: 1. The `contains` functions are covered by tests 2. The inconsistent behavior of `containGeneric` is replaced by `StringUtils.Contains` and `SliceUtils.Contains` 3. In the future we can move more help functions into XxxUtils to simplify the `helper.go` and reduce unnecessary global functions. FAQ: 1. Why it's called `StringUtils.Contains` but not `strings.Contains` like Golang? Because our `StringUtils` is not Golang's `strings` package. There will be our own string functions. --------- Co-authored-by: silverwind <me@silverwind.io>
* Merge template functions "dict/Dict/mergeinto" (#23932)wxiaoguang2023-04-071-0/+43
One of the steps in #23328 Before there were 3 different but similar functions: dict/Dict/mergeinto The code was just copied & pasted, no test. This PR defines a new stable `dict` function, it covers all the 3 old functions behaviors, only +160 -171 Future developers do not need to think about or guess the different dict functions, just use one: `dict` Why use `dict` but not `Dict`? Because there are far more `dict` than `Dict` in code already ......