github.com/onsi/ginkgo@v1.16.6-0.20211118180735-4e1925ba4c95/extensions/globals/globals_test.go (about)

     1  package globals_test
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/onsi/ginkgo/extensions/globals"
     7  	"github.com/onsi/ginkgo/internal/global"
     8  )
     9  
    10  func TestGlobals(t *testing.T) {
    11  	global.InitializeGlobals()
    12  	oldSuite := global.Suite
    13  	if oldSuite == nil {
    14  		t.Error("global.Suite was nil")
    15  	}
    16  
    17  	globals.Reset()
    18  	newSuite := global.Suite
    19  	if newSuite == nil {
    20  		t.Error("new global.Suite was nil")
    21  	}
    22  
    23  	if oldSuite == newSuite {
    24  		t.Error("got the same suite but expected it to be different!")
    25  	}
    26  }