mirror of
https://github.com/MontFerret/ferret.git
synced 2025-11-27 22:08:15 +02:00
New type system (#232)
* New type system * Fixed dot notation for HTML elements
This commit is contained in:
@@ -31,24 +31,28 @@ func (tc *testCase) Do(t *testing.T, fn core.Function) {
|
||||
So(err, ShouldBeNil)
|
||||
}
|
||||
|
||||
So(actual.Type(), ShouldEqual, expected.Type())
|
||||
So(actual.Type().Equals(expected.Type()), ShouldBeTrue)
|
||||
So(actual.Compare(expected), ShouldEqual, 0)
|
||||
})
|
||||
}
|
||||
|
||||
func mustDefaultLayoutDt(timeString string) values.DateTime {
|
||||
dt, err := defaultLayoutDt(timeString)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return dt
|
||||
}
|
||||
|
||||
func mustLayoutDt(layout, value string) values.DateTime {
|
||||
dt, err := layoutDt(layout, value)
|
||||
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
return dt
|
||||
}
|
||||
|
||||
@@ -58,8 +62,10 @@ func defaultLayoutDt(timeString string) (values.DateTime, error) {
|
||||
|
||||
func layoutDt(layout, value string) (values.DateTime, error) {
|
||||
t, err := time.Parse(layout, value)
|
||||
|
||||
if err != nil {
|
||||
return values.DateTime{}, err
|
||||
}
|
||||
|
||||
return values.NewDateTime(t), nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user