storj/lib/uplinkc/handles_test.go
Egon Elbre edf8318c0e
jenkins: update to golangci-lint 1.21.0 (#3289)
* jenkins: update to golint-1.21.0
* don't use underscores in var
* make handles private to satisfy linter

lib\uplinkc\universe.go:32:39: exported method Add returns unexported type storj.io/storj/lib/uplinkc._Ctype_long, which can be annoying to use (golint)
   func (m *Universe) Add(x interface{}) Handle {

* disable wsl explicitly
2019-10-17 10:42:22 +03:00

40 lines
642 B
Go

// Copyright (C) 2019 Storj Labs, Inc.
// See LICENSE for copying information.
package main
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestUniverse(t *testing.T) {
{
handles := newHandles()
str := "testing 123"
handle := handles.Add(str)
got := handles.Get(handle)
assert.Equal(t, str, got)
handles.Del(handle)
assert.True(t, handles.Empty())
}
{
handles := newHandles()
str := "testing 123"
handle := handles.Add(&str)
got := handles.Get(handle)
assert.Equal(t, str, *got.(*string))
handles.Del(handle)
assert.True(t, handles.Empty())
assert.Nil(t, handles.Get(handle))
}
}