Exemple #1
0
func TestGLSWith(t *testing.T) {
	is := is.New(t)

	With(Values{"key": "value"}, func() {
		v := Get("key")
		is.NotNil(v)
		is.Equal(v, "value")
	})

	v := Get("key")
	is.Nil(v)
}
Exemple #2
0
func TestGLSSetValues(t *testing.T) {
	is := is.New(t)

	Set("key", "value")
	v := Get("key")
	is.NotNil(v)
	is.Equal(v, "value")

	SetValues(Values{"answer": 42})
	v = Get("key")
	is.Nil(v)

	v = Get("answer")
	is.NotNil(v)
	is.Equal(v, 42)

	Cleanup()
}