package storetest

import (
	

	
)

// TestSharedVar tests the shared variable functionality of a Store.
func ( *testing.T,  store.Store) {
	 := "foo"
	 := "lorem ipsum"
	 := "o mores, o tempora"

	// Getting an nonexistent variable should return ErrNoSharedVar.
	,  := .SharedVar()
	if !matchErr(, store.ErrNoSharedVar) {
		.Error("want ErrNoSharedVar, got", )
	}

	// Setting a variable for the first time creates it.
	 = .SetSharedVar(, )
	if  != nil {
		.Error("want no error, got", )
	}
	,  := .SharedVar()
	if  !=  ||  != nil {
		.Errorf("want %q and no error, got %q and %v", , , )
	}

	// Setting an existing variable updates its value.
	 = .SetSharedVar(, )
	if  != nil {
		.Error("want no error, got", )
	}
	,  = .SharedVar()
	if  !=  ||  != nil {
		.Errorf("want %q and no error, got %q and %v", , , )
	}

	// After deleting a variable, access to it cause ErrNoSharedVar.
	 = .DelSharedVar()
	if  != nil {
		.Error("want no error, got", )
	}
	_,  = .SharedVar()
	if !matchErr(, store.ErrNoSharedVar) {
		.Error("want ErrNoSharedVar, got", )
	}
}