github.com/eden-framework/sqlx@v0.0.2/nullable/null_ignore_scanner_test.go (about) 1 package nullable 2 3 import ( 4 "testing" 5 6 "github.com/onsi/gomega" 7 ) 8 9 func TestNullIgnoreScanner(t *testing.T) { 10 t.Run("scan value", func(t *testing.T) { 11 v := 0 12 s := NewNullIgnoreScanner(&v) 13 s.Scan(2) 14 15 gomega.NewWithT(t).Expect(v).To(gomega.Equal(2)) 16 }) 17 18 t.Run("scan nil", func(t *testing.T) { 19 v := 0 20 s := NewNullIgnoreScanner(&v) 21 s.Scan(nil) 22 23 gomega.NewWithT(t).Expect(v).To(gomega.Equal(0)) 24 }) 25 }