1
0
mirror of https://github.com/danog/liquid.git synced 2024-12-11 16:19:38 +01:00
liquid/evaluator/predicates_test.go
Oliver Steele d435cf5211 tests
2017-07-07 07:38:53 -04:00

27 lines
650 B
Go

package evaluator
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestIsEmpty(t *testing.T) {
require.True(t, IsEmpty(false))
require.False(t, IsEmpty(true))
require.True(t, IsEmpty([]string{}))
require.True(t, IsEmpty(map[string]interface{}{}))
require.False(t, IsEmpty([]string{""}))
require.False(t, IsEmpty(map[string]interface{}{"k": "v"}))
}
func TestIsTrue(t *testing.T) {
require.False(t, IsTrue(nil))
require.False(t, IsTrue(false))
require.True(t, IsTrue(true))
require.True(t, IsTrue(0))
require.True(t, IsTrue(""))
require.True(t, IsTrue([]string{}))
require.True(t, IsTrue(map[string]interface{}{}))
}