mirror of
https://github.com/danog/liquid.git
synced 2024-11-30 08:28:58 +01:00
tests
This commit is contained in:
parent
846987d86a
commit
d435cf5211
26
evaluator/predicates_test.go
Normal file
26
evaluator/predicates_test.go
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
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{}{}))
|
||||||
|
}
|
Loading…
Reference in New Issue
Block a user