mirror of
https://github.com/MontFerret/ferret.git
synced 2024-12-16 11:37:36 +02:00
44 lines
950 B
Go
44 lines
950 B
Go
|
package datetime_test
|
||
|
|
||
|
import (
|
||
|
"testing"
|
||
|
|
||
|
"github.com/MontFerret/ferret/pkg/runtime/core"
|
||
|
"github.com/MontFerret/ferret/pkg/runtime/values"
|
||
|
"github.com/MontFerret/ferret/pkg/stdlib/datetime"
|
||
|
)
|
||
|
|
||
|
func TestDateMinute(t *testing.T) {
|
||
|
tcs := []*testCase{
|
||
|
&testCase{
|
||
|
Name: "When more than 1 arguments",
|
||
|
Expected: values.None,
|
||
|
Args: []core.Value{
|
||
|
values.NewString("string"),
|
||
|
values.NewInt(0),
|
||
|
},
|
||
|
ShouldErr: true,
|
||
|
},
|
||
|
&testCase{
|
||
|
Name: "When 0 arguments",
|
||
|
Expected: values.None,
|
||
|
Args: []core.Value{},
|
||
|
ShouldErr: true,
|
||
|
},
|
||
|
&testCase{
|
||
|
Name: "When 4th minute",
|
||
|
Expected: values.NewInt(4),
|
||
|
Args: []core.Value{mustDefaultLayoutDt("1999-02-07T15:04:05Z")},
|
||
|
},
|
||
|
&testCase{
|
||
|
Name: "When 59th minute",
|
||
|
Expected: values.NewInt(59),
|
||
|
Args: []core.Value{mustDefaultLayoutDt("1629-02-28T15:59:05Z")},
|
||
|
},
|
||
|
}
|
||
|
|
||
|
for _, tc := range tcs {
|
||
|
tc.Do(t, datetime.DateMinute)
|
||
|
}
|
||
|
}
|