@@ -20,26 +20,26 @@ func TestLoadDefault(t *testing.T) {
20
20
}
21
21
want := ""
22
22
if config .DSN != want {
23
- t .Errorf ("actual %v\n want %v" , config .DSN , want )
23
+ t .Errorf ("got %v\n want %v" , config .DSN , want )
24
24
}
25
25
want2 := "dbdoc"
26
26
if config .DocPath != want2 {
27
- t .Errorf ("actual %v\n want %v" , config .DocPath , want2 )
27
+ t .Errorf ("got %v\n want %v" , config .DocPath , want2 )
28
28
}
29
29
want3 := "png"
30
30
if config .ER .Format != want3 {
31
- t .Errorf ("actual %v\n want %v" , config .ER .Format , want3 )
31
+ t .Errorf ("got %v\n want %v" , config .ER .Format , want3 )
32
32
}
33
33
want4 := 1
34
34
if * config .ER .Distance != want4 {
35
- t .Errorf ("actual %v\n want %v" , config .ER .Distance , want4 )
35
+ t .Errorf ("got %v\n want %v" , config .ER .Distance , want4 )
36
36
}
37
37
}
38
38
39
39
func TestLoadConfigFile (t * testing.T ) {
40
40
_ = os .Setenv ("TBLS_TEST_PG_PASS" , "pgpass" )
41
41
_ = os .Setenv ("TBLS_TEST_PG_DOC_PATH" , "sample/pg" )
42
- configFilepath := filepath .Join (testdataDir (), "env_testdb_tbls .yml" )
42
+ configFilepath := filepath .Join (testdataDir (), "config_test_tbls_2 .yml" )
43
43
config , err := NewConfig ()
44
44
if err != nil {
45
45
t .Fatal (err )
@@ -48,19 +48,23 @@ func TestLoadConfigFile(t *testing.T) {
48
48
if err != nil {
49
49
t .Fatal (err )
50
50
}
51
- expected := "pg://root:pgpass@localhost:55432/testdb?sslmode=disable"
52
- if config .DSN != expected {
53
- t .Errorf ("actual %v\n want %v" , config .DSN , expected )
51
+
52
+ if want := "pg://root:pgpass@localhost:55432/testdb?sslmode=disable" ; config .DSN != want {
53
+ t .Errorf ("got %v\n want %v" , config .DSN , want )
54
+ }
55
+
56
+ if want := "sample/pg" ; config .DocPath != want {
57
+ t .Errorf ("got %v\n want %v" , config .DocPath , want )
54
58
}
55
- expected2 := "sample/pg"
56
- if config .DocPath != expected2 {
57
- t .Errorf ("actual %v\n want %v" , config .DocPath , expected2 )
59
+
60
+ if want := "INDEX" ; config .Dict . Lookup ( "Indexes" ) != want {
61
+ t .Errorf ("got %v\n want %v" , config .Dict . Lookup ( "Indexes" ), want )
58
62
}
59
63
}
60
64
61
65
var tests = []struct {
62
- value string
63
- expected string
66
+ value string
67
+ want string
64
68
}{
65
69
{"${TBLS_ONE}/${TBLS_TWO}" , "one/two" },
66
70
{"${TBLS_ONE}/${TBLS_TWO}/${TBLS_NONE}" , "one/two/" },
@@ -72,12 +76,12 @@ func TestParseWithEnvirion(t *testing.T) {
72
76
_ = os .Setenv ("TBLS_ONE" , "one" )
73
77
_ = os .Setenv ("TBLS_TWO" , "two" )
74
78
for _ , tt := range tests {
75
- actual , err := parseWithEnviron (tt .value )
79
+ got , err := parseWithEnviron (tt .value )
76
80
if err != nil {
77
81
t .Fatal (err )
78
82
}
79
- if actual != tt .expected {
80
- t .Errorf ("actual %v\n want %v" , actual , tt .expected )
83
+ if got != tt .want {
84
+ t .Errorf ("got %v\n want %v" , got , tt .want )
81
85
}
82
86
}
83
87
}
@@ -132,17 +136,17 @@ func TestMergeAditionalData(t *testing.T) {
132
136
if err != nil {
133
137
t .Error (err )
134
138
}
135
- expected := 1
136
- actual := len (s .Relations )
137
- if actual != expected {
138
- t .Errorf ("actual %v\n want %v" , actual , expected )
139
+ want := 1
140
+ got := len (s .Relations )
141
+ if got != want {
142
+ t .Errorf ("got %v\n want %v" , got , want )
139
143
}
140
144
posts , _ := s .FindTableByName ("posts" )
141
145
title , _ := posts .FindColumnByName ("title" )
142
- expected2 := "post title"
143
- actual2 := title .Comment
144
- if actual2 != expected2 {
145
- t .Errorf ("actual %v\n want %v" , actual2 , expected2 )
146
+ want2 := "post title"
147
+ got2 := title .Comment
148
+ if got2 != want2 {
149
+ t .Errorf ("got %v\n want %v" , got2 , want2 )
146
150
}
147
151
}
148
152
@@ -227,10 +231,10 @@ func TestFilterTables(t *testing.T) {
227
231
if err != nil {
228
232
t .Error (err )
229
233
}
230
- expected := 2
231
- actual := len (s .Tables )
232
- if actual != expected {
233
- t .Errorf ("actual %v\n want %v" , actual , expected )
234
+ want := 2
235
+ got := len (s .Tables )
236
+ if got != want {
237
+ t .Errorf ("got %v\n want %v" , got , want )
234
238
}
235
239
}
236
240
@@ -297,22 +301,22 @@ func TestModifySchema(t *testing.T) {
297
301
if err != nil {
298
302
t .Error (err )
299
303
}
300
- expected := 1
301
- actual := len (s .Relations )
302
- if actual != expected {
303
- t .Errorf ("actual %v\n want %v" , actual , expected )
304
+ want := 1
305
+ got := len (s .Relations )
306
+ if got != want {
307
+ t .Errorf ("got %v\n want %v" , got , want )
304
308
}
305
309
posts , _ := s .FindTableByName ("posts" )
306
310
title , _ := posts .FindColumnByName ("title" )
307
- expected2 := "post title"
308
- actual2 := title .Comment
309
- if actual2 != expected2 {
310
- t .Errorf ("actual %v\n want %v" , actual2 , expected2 )
311
+ want2 := "post title"
312
+ got2 := title .Comment
313
+ if got2 != want2 {
314
+ t .Errorf ("got %v\n want %v" , got2 , want2 )
311
315
}
312
- expected3 := 2
313
- actual3 := len (s .Tables )
314
- if actual3 != expected3 {
315
- t .Errorf ("actual %v\n want %v" , actual , expected )
316
+ want3 := 2
317
+ got3 := len (s .Tables )
318
+ if got3 != want3 {
319
+ t .Errorf ("got %v\n want %v" , got , want )
316
320
}
317
321
}
318
322
0 commit comments