elvish/pkg/eval/vals/bool_test.go
2021-01-27 01:30:25 +00:00

28 lines
446 B
Go

package vals
import (
"testing"
. "src.elv.sh/pkg/tt"
)
type customBooler struct{ b bool }
func (b customBooler) Bool() bool { return b.b }
type customNonBooler struct{}
func TestBool(t *testing.T) {
Test(t, Fn("Bool", Bool), Table{
Args(nil).Rets(false),
Args(true).Rets(true),
Args(false).Rets(false),
Args(customBooler{true}).Rets(true),
Args(customBooler{false}).Rets(false),
Args(customNonBooler{}).Rets(true),
})
}