github.com/MontFerret/ferret@v0.18.0/pkg/stdlib/testing/true.go (about)

     1  package testing
     2  
     3  import (
     4  	"context"
     5  	"fmt"
     6  
     7  	"github.com/MontFerret/ferret/pkg/runtime/core"
     8  	"github.com/MontFerret/ferret/pkg/runtime/values"
     9  	"github.com/MontFerret/ferret/pkg/stdlib/testing/base"
    10  )
    11  
    12  // TRUE asserts that value is true.
    13  // @param {Any} actual - Value to test.
    14  // @param {String} [message] - Message to display on error.
    15  var True = base.Assertion{
    16  	DefaultMessage: func(args []core.Value) string {
    17  		return fmt.Sprintf("be %s", base.FormatValue(values.True))
    18  	},
    19  	MinArgs: 1,
    20  	MaxArgs: 2,
    21  	Fn: func(ctx context.Context, args []core.Value) (bool, error) {
    22  		return args[0] == values.True, nil
    23  	},
    24  }