...

Source file src/github.com/go-openapi/validate/pools_debug_test.go

Documentation: github.com/go-openapi/validate

     1  //go:build validatedebug
     2  
     3  package validate
     4  
     5  import (
     6  	"path/filepath"
     7  	"testing"
     8  
     9  	"github.com/go-openapi/loads"
    10  	"github.com/go-openapi/strfmt"
    11  	"github.com/stretchr/testify/require"
    12  )
    13  
    14  func Test_Debug_2866(t *testing.T) {
    15  	// This test to be run with build flag "validatedebug": it uses the debug pools and asserts that
    16  	// all allocated objects are indeed redeemed at the end of the spec validation.
    17  
    18  	resetPools()
    19  	fp := filepath.Join("fixtures", "bugs", "2866", "2866.yaml")
    20  
    21  	doc, err := loads.Spec(fp)
    22  	require.NoError(t, err)
    23  	require.NotNil(t, doc)
    24  
    25  	require.NoError(t, Spec(doc, strfmt.Default))
    26  
    27  	require.True(t, pools.allIsRedeemed(t))
    28  }
    29  

View as plain text