People: Add include and exclude as aliases for yes and no in search #22
This commit is contained in:
parent
0d160fe833
commit
58e3573e10
2 changed files with 14 additions and 2 deletions
|
@ -19,12 +19,12 @@ func Bool(s string) bool {
|
|||
func Yes(s string) bool {
|
||||
s = strings.ToLower(strings.TrimSpace(s))
|
||||
|
||||
return strings.IndexAny(s, "ytjoseд") == 0
|
||||
return strings.IndexAny(s, "ytjosiд") == 0
|
||||
}
|
||||
|
||||
// No returns true if a string represents "no".
|
||||
func No(s string) bool {
|
||||
s = strings.ToLower(strings.TrimSpace(s))
|
||||
|
||||
return strings.IndexAny(s, "0nhfн") == 0
|
||||
return strings.IndexAny(s, "0nhfeн") == 0
|
||||
}
|
||||
|
|
|
@ -61,6 +61,12 @@ func TestYes(t *testing.T) {
|
|||
t.Run("false", func(t *testing.T) {
|
||||
assert.Equal(t, false, Yes("false"))
|
||||
})
|
||||
t.Run("exclude", func(t *testing.T) {
|
||||
assert.Equal(t, false, Yes("exclude"))
|
||||
})
|
||||
t.Run("include", func(t *testing.T) {
|
||||
assert.Equal(t, true, Yes("include"))
|
||||
})
|
||||
t.Run("empty", func(t *testing.T) {
|
||||
assert.Equal(t, false, Yes(""))
|
||||
})
|
||||
|
@ -91,6 +97,12 @@ func TestNo(t *testing.T) {
|
|||
t.Run("false", func(t *testing.T) {
|
||||
assert.Equal(t, true, No("false"))
|
||||
})
|
||||
t.Run("exclude", func(t *testing.T) {
|
||||
assert.Equal(t, true, No("exclude"))
|
||||
})
|
||||
t.Run("include", func(t *testing.T) {
|
||||
assert.Equal(t, false, No("include"))
|
||||
})
|
||||
t.Run("empty", func(t *testing.T) {
|
||||
assert.Equal(t, false, No(""))
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue