2015-03-14 05:57:18 +03:00
|
|
|
// +build lmdb
|
|
|
|
|
2015-02-03 05:17:15 +03:00
|
|
|
package mdb
|
|
|
|
|
|
|
|
import (
|
|
|
|
"syscall"
|
2015-03-14 05:57:18 +03:00
|
|
|
"testing"
|
2015-02-03 05:17:15 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestErrno(t *testing.T) {
|
|
|
|
zeroerr := errno(0)
|
|
|
|
if zeroerr != nil {
|
|
|
|
t.Errorf("errno(0) != nil: %#v", zeroerr)
|
|
|
|
}
|
|
|
|
syserr := _errno(int(syscall.EINVAL))
|
|
|
|
if syserr != syscall.EINVAL { // fails if syserr is Errno(syscall.EINVAL)
|
|
|
|
t.Errorf("errno(syscall.EINVAL) != syscall.EINVAL: %#v", syserr)
|
|
|
|
}
|
|
|
|
mdberr := _errno(int(KeyExist))
|
|
|
|
if mdberr != KeyExist { // fails if syserr is Errno(syscall.EINVAL)
|
|
|
|
t.Errorf("errno(KeyExist) != KeyExist: %#v", syserr)
|
|
|
|
}
|
|
|
|
}
|