res_tracker/res_tracker_test.go

23 lines
440 B
Go

package res_tracker_test
import (
"testing"
"git.bit5.ru/backend/res_tracker"
"github.com/stretchr/testify/assert"
)
func TestSimpleTrack(t *testing.T) {
var foo interface{}
res_tracker.Enable(res_tracker.LITE)
defer res_tracker.Enable(res_tracker.OFF)
assert.Equal(t, 0, res_tracker.Count())
res_tracker.Track(foo)
assert.Equal(t, 1, res_tracker.Count())
res_tracker.Untrack(foo)
assert.Equal(t, 0, res_tracker.Count())
}