-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathconfig_test.go
executable file
·49 lines (38 loc) · 1.02 KB
/
config_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
39
40
41
42
43
44
45
46
47
48
49
package dsc_test
import (
"fmt"
"github.com/stretchr/testify/assert"
"github.com/viant/dsc"
"testing"
)
func TestConfigHasDateLayout(t *testing.T) {
{
config := dsc.NewConfig("sqlite3", "[url]", "url:./test/foo.db")
assert.False(t, config.HasDateLayout())
}
{
config := dsc.NewConfig("sqlite3", "[url]", "url:./test/foo.db,dateFormat:yyyy-MM-dd hh:mm:ss")
assert.True(t, config.HasDateLayout())
}
}
func TestConfigHasParameterLayout(t *testing.T) {
{
config := dsc.NewConfig("sqlite3", "[url]", "url:./test/foo.db")
assert.False(t, config.Has("url1"))
}
{
config := dsc.NewConfig("sqlite3", "[url]", "url:./test/foo.db,dateFormat:yyyy-MM-dd hh:mm:ss")
assert.True(t, config.Has("url"))
}
}
func TestGetPanic(t *testing.T) {
config := dsc.NewConfig("sqlite3", "[url]", "url:./test/foo.db")
defer func() {
if err := recover(); err != nil {
expected := "Missing value in descriptor abc"
actual := fmt.Sprintf("%v", err)
assert.Equal(t, actual, expected, "Assert Kind")
}
}()
config.Get("abc")
}