1
0
mirror of https://github.com/danog/liquid.git synced 2024-12-02 17:28:38 +01:00
liquid/values/drop_test.go

25 lines
601 B
Go
Raw Normal View History

2017-07-28 00:11:37 +02:00
package values
2017-07-06 05:25:03 +02:00
import (
"testing"
"github.com/stretchr/testify/require"
)
2017-07-21 22:26:04 +02:00
type testDrop struct{ proxy interface{} }
2017-07-06 05:25:03 +02:00
2017-07-21 22:26:04 +02:00
func (d testDrop) ToLiquid() interface{} { return d.proxy }
2017-07-06 05:25:03 +02:00
func TestToLiquid(t *testing.T) {
require.Equal(t, 2, ToLiquid(2))
2017-07-21 22:26:04 +02:00
require.Equal(t, 3, ToLiquid(testDrop{3}))
}
func TestValue_drop(t *testing.T) {
dv := ValueOf(testDrop{"seafood"})
require.Equal(t, "seafood", dv.Interface())
require.Equal(t, true, dv.Contains(ValueOf("foo")))
require.Equal(t, true, dv.Contains(ValueOf(testDrop{"foo"})))
require.Equal(t, 7, dv.PropertyValue(ValueOf("size")).Interface())
2017-07-06 05:25:03 +02:00
}