MCPcopy Create free account
hub / github.com/Masterminds/semver / TestScanInputTypes

Function TestScanInputTypes

version_test.go:976–1000  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

974}
975
976func TestScanInputTypes(t *testing.T) {
977 v := &Version{}
978 if err := v.Scan("1.2.3"); err != nil {
979 t.Errorf("Scan(string) unexpected error: %v", err)
980 }
981 if v.String() != "1.2.3" {
982 t.Errorf("Scan(string): got %q, want %q", v.String(), "1.2.3")
983 }
984
985 v = &Version{}
986 if err := v.Scan([]byte("2.3.4")); err != nil {
987 t.Errorf("Scan([]byte) unexpected error: %v", err)
988 }
989 if v.String() != "2.3.4" {
990 t.Errorf("Scan([]byte): got %q, want %q", v.String(), "2.3.4")
991 }
992
993 if err := (&Version{}).Scan(nil); err == nil {
994 t.Errorf("Scan(nil): expected error, got nil")
995 }
996
997 if err := (&Version{}).Scan(42); err == nil {
998 t.Errorf("Scan(int): expected error, got nil")
999 }
1000}
1001
1002func TestDriverValuer(t *testing.T) {
1003 sVer := "1.1.1"

Callers

nothing calls this directly

Calls 2

ScanMethod · 0.95
StringMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…