mirror of
https://github.com/MontFerret/ferret.git
synced 2025-01-18 03:22:02 +02:00
values.Parse does not parse int64 (#621)
This commit is contained in:
parent
ff5af6f739
commit
833330e73c
@ -114,6 +114,14 @@ func Parse(input interface{}) core.Value {
|
||||
return NewBoolean(value)
|
||||
case string:
|
||||
return NewString(value)
|
||||
case int64:
|
||||
return NewInt(int(value))
|
||||
case int32:
|
||||
return NewInt(int(value))
|
||||
case int16:
|
||||
return NewInt(int(value))
|
||||
case int8:
|
||||
return NewInt(int(value))
|
||||
case int:
|
||||
return NewInt(value)
|
||||
case float64:
|
||||
|
@ -159,6 +159,28 @@ func TestHelpers(t *testing.T) {
|
||||
})
|
||||
})
|
||||
|
||||
Convey("Parse", func() {
|
||||
Convey("It should parse values", func() {
|
||||
inputs := []struct {
|
||||
Parsed core.Value
|
||||
Raw interface{}
|
||||
}{
|
||||
{Parsed: values.NewInt(1), Raw: int(1)},
|
||||
{Parsed: values.NewInt(1), Raw: int8(1)},
|
||||
{Parsed: values.NewInt(1), Raw: int16(1)},
|
||||
{Parsed: values.NewInt(1), Raw: int32(1)},
|
||||
{Parsed: values.NewInt(1), Raw: int64(1)},
|
||||
}
|
||||
|
||||
for _, input := range inputs {
|
||||
out := values.Parse(input.Raw)
|
||||
|
||||
So(out.Type().ID(), ShouldEqual, input.Parsed.Type().ID())
|
||||
So(out.Unwrap(), ShouldEqual, input.Parsed.Unwrap())
|
||||
}
|
||||
})
|
||||
})
|
||||
|
||||
Convey("ToBoolean", func() {
|
||||
Convey("Should convert values", func() {
|
||||
inputs := [][]core.Value{
|
||||
|
Loading…
x
Reference in New Issue
Block a user