forked from doug-martin/goqu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadapters_test.go
49 lines (41 loc) · 1020 Bytes
/
adapters_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 goqu
import (
"testing"
"github.com/c2fo/testify/assert"
"github.com/c2fo/testify/suite"
)
type adapterTest struct {
suite.Suite
}
func (me *adapterTest) TestHasAdapter() {
t := me.T()
assert.False(t, HasAdapter("test"))
RegisterAdapter("test", func(ds *Dataset) Adapter {
return NewDefaultAdapter(ds)
})
assert.True(t, HasAdapter("test"))
removeAdapter("test")
}
func (me *adapterTest) TestRegisterAdapter() {
t := me.T()
RegisterAdapter("test", func(ds *Dataset) Adapter {
return NewDefaultAdapter(ds)
})
assert.True(t, HasAdapter("test"))
removeAdapter("test")
}
func (me *adapterTest) TestNewAdapter() {
t := me.T()
RegisterAdapter("test", func(ds *Dataset) Adapter {
return NewDefaultAdapter(ds)
})
assert.True(t, HasAdapter("test"))
adapter := NewAdapter("test", From("test"))
assert.NotNil(t, adapter)
removeAdapter("test")
adapter = NewAdapter("test", From("test"))
assert.NotNil(t, adapter)
}
func TestAdapterSuite(t *testing.T) {
suite.Run(t, new(adapterTest))
}