github.com/MontFerret/ferret@v0.18.0/pkg/stdlib/testing/none.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  // NONE asserts that value is none.
    13  // @param {Any} actual - Value to test.
    14  // @param {String} [message] - Message to display on error.
    15  var None = base.Assertion{
    16  	DefaultMessage: func(args []core.Value) string {
    17  		return fmt.Sprintf("be %s", base.FormatValue(values.None))
    18  	},
    19  	MinArgs: 1,
    20  	MaxArgs: 2,
    21  	Fn: func(ctx context.Context, args []core.Value) (bool, error) {
    22  		return args[0] == values.None, nil
    23  	},
    24  }