mirror of https://github.com/perkeep/perkeep.git
27 lines
378 B
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")
|
|
}
|
|
}
|