(t *testing.T)
| 555 | } |
| 556 | |
| 557 | func TestParseFunctionArguments(t *testing.T) { |
| 558 | testData := []struct { |
| 559 | expr string |
| 560 | expect interface{} |
| 561 | }{ |
| 562 | {"", []interface{}{}}, |
| 563 | {"123", []interface{}{123}}, |
| 564 | {"1.23", []interface{}{1.23}}, |
| 565 | {"-123", []interface{}{-123}}, |
| 566 | {"-1.23", []interface{}{-1.23}}, |
| 567 | {"abc", []interface{}{"abc"}}, |
| 568 | {"$var", []interface{}{"$var"}}, |
| 569 | {"1,2", []interface{}{1, 2}}, |
| 570 | {"1,2.3", []interface{}{1, 2.3}}, |
| 571 | {"1, -2.3", []interface{}{1, -2.3}}, |
| 572 | {"1,,2", []interface{}{1, nil, 2}}, |
| 573 | {" $var1 , 2 ", []interface{}{"$var1", 2}}, |
| 574 | } |
| 575 | |
| 576 | for _, data := range testData { |
| 577 | value, err := parseFunctionArguments(data.expr) |
| 578 | if !assert.NoError(t, err) { |
| 579 | t.Fatal() |
| 580 | } |
| 581 | if !assert.Equal(t, data.expect, value) { |
| 582 | t.Fatal() |
| 583 | } |
| 584 | } |
| 585 | } |
| 586 | |
| 587 | func TestParseDataStringWithFunctions(t *testing.T) { |
| 588 | variablesMapping := map[string]interface{}{ |
nothing calls this directly
no test coverage detected