github.com/authzed/spicedb@v1.32.1-0.20240520085336-ebda56537386/pkg/caveats/env_test.go (about)

     1  package caveats
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/stretchr/testify/require"
     7  
     8  	"github.com/authzed/spicedb/pkg/caveats/types"
     9  )
    10  
    11  func TestAddVariable(t *testing.T) {
    12  	req := require.New(t)
    13  	env := NewEnvironment()
    14  	err := env.AddVariable("foobar", types.IntType)
    15  	req.NoError(err)
    16  	err = env.AddVariable("foobar", types.IntType)
    17  	req.Error(err)
    18  }