2019-12-03 04:50:32 +00:00
|
|
|
package yqlib
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2019-12-09 02:44:53 +00:00
|
|
|
"github.com/mikefarah/yq/v3/test"
|
2019-12-03 04:50:32 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
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)
|
|
|
|
}
|
|
|
|
}
|