Skip to content

Commit 425a783

Browse files
committed
feat: improve tests
1 parent e9166da commit 425a783

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

api/data_to_point_test.go

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,28 @@ func TestDataToPoint(t *testing.T) {
200200
},
201201
error: `cannot use map[string]interface {} as point`,
202202
},
203+
{
204+
name: "test unsupported field type",
205+
s: &struct {
206+
Measurement string `lp:"measurement"`
207+
Temp complex64 `lp:"field,a"`
208+
}{
209+
"air",
210+
complex(1, 1),
211+
},
212+
error: `cannot use field 'Temp' of type 'complex64' as to create a point`,
213+
},
214+
{
215+
name: "test unsupported lp tag value",
216+
s: &struct {
217+
Measurement string `lp:"measurement"`
218+
Temp float64 `lp:"data,a"`
219+
}{
220+
"air",
221+
1.0,
222+
},
223+
error: `invalid tag data`,
224+
},
203225
}
204226
for _, ts := range tests {
205227
t.Run(ts.name, func(t *testing.T) {

0 commit comments

Comments
 (0)