forked from huandu/go-sqlbuilder
-
Notifications
You must be signed in to change notification settings - Fork 0
/
opt_test.go
38 lines (32 loc) · 910 Bytes
/
opt_test.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
// Copyright 2018 Huan Du. All rights reserved.
// Copyright 2022 OOO SuperJob. All rights reserved.
// Licensed under the MIT license that can be found in the LICENSE file.
package sphinxql
import (
"testing"
"github.com/huandu/go-assert"
)
func TestOption(t *testing.T) {
a := assert.New(t)
cases := map[string]func() string{
"comment = $0": func() string { return newTestOption().Comment("kekw") },
"field_weights = $0": func() string {
return newTestOption().FieldWeights(NamedIntegerList{
"first_field": 10,
"second_field": 20,
"third_field": 30,
})
},
"max_matches = $0": func() string { return newTestOption().MaxMatches(5) },
"ranker = $0": func() string { return newTestOption().Ranker(RankerWordCount) },
}
for expected, f := range cases {
actual := f()
a.Equal(actual, expected)
}
}
func newTestOption() *Opt {
return &Opt{
Args: &Args{},
}
}