Exemple #1
0
func TestEqual(t *testing.T) {
	err1 := errors.New(5, nil, "abc")
	err2 := errors.New(5, nil, "abc")

	err3 := errors.New(6, err1, "abc")
	err4 := errors.New(6, err1, "abc")

	assert.False(t, err1 == err2)
	assert.False(t, err3 == err4)
}
Exemple #2
0
func TestSessionID(t *testing.T) {
	m := make(map[string]interface{}, 0)

	// 随机产生几个字符串,看是否有可能重复
	for i := 0; i < 10000; i++ {
		sid, err := sessionID()
		assert.Nil(t, err)
		//assert.Equal(t, len(sid), sessionIDLen)

		_, found := m[sid]
		assert.False(t, found)

		m[sid] = nil
	}
}