1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-09 07:02:29 +08:00

TernaryOperator Reduce if else operations (#56)

* feat:(slice add AppendIfAbsent function)

* feat:(slice add TernaryOperator function)

Co-authored-by: george.zheng <george.zheng@ambergroup.io>
This commit is contained in:
郑一诺她爸
2022-08-27 19:12:03 +08:00
committed by GitHub
parent 9239bcfdc3
commit 72e1d92fa1
2 changed files with 24 additions and 0 deletions

14
common/common_test.go Normal file
View File

@@ -0,0 +1,14 @@
package common
import (
"github.com/duke-git/lancet/v2/internal"
"testing"
)
func TestTernaryOperator(t *testing.T) {
assert := internal.NewAssert(t, "TernaryOperator")
trueValue := "1"
falseValue := "0"
assert.Equal(trueValue, TernaryOperator(true, trueValue, falseValue))
}