yq/pkg/yqlib/value_parser_test.go

26 lines
549 B
Go
Raw Normal View History

package yqlib
import (
"testing"
2019-12-04 05:10:28 +00:00
"github.com/mikefarah/yq/v2/test"
)
var parseValueTests = []struct {
argument string
expectedResult interface{}
testDescription string
}{
{"true", true, "boolean"},
{"\"true\"", "true", "boolean as string"},
{"3.4", 3.4, "number"},
{"\"3.4\"", "3.4", "number as string"},
{"", "", "empty string"},
}
func TestParseValue(t *testing.T) {
for _, tt := range parseValueTests {
test.AssertResultWithContext(t, tt.expectedResult, NewValueParser().ParseValue(tt.argument), tt.testDescription)
}
}