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

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