perkeep/third_party/github.com/bmizerany/pq/encode_test.go

27 lines
378 B
Go

package pq
import (
"testing"
"time"
)
func TestScanTimestamp(t *testing.T) {
var nt NullTime
tn := time.Now()
(&nt).Scan(tn)
if !nt.Valid {
t.Errorf("Expected Valid=false")
}
if nt.Time != tn {
t.Errorf("Time value mismatch")
}
}
func TestScanNilTimestamp(t *testing.T) {
var nt NullTime
(&nt).Scan(nil)
if nt.Valid {
t.Errorf("Expected Valid=false")
}
}