connection_go18_test.go 765 B

123456789101112131415161718192021222324252627282930
  1. // Go MySQL Driver - A MySQL-Driver for Go's database/sql package
  2. //
  3. // Copyright 2017 The Go-MySQL-Driver Authors. All rights reserved.
  4. //
  5. // This Source Code Form is subject to the terms of the Mozilla Public
  6. // License, v. 2.0. If a copy of the MPL was not distributed with this file,
  7. // You can obtain one at http://mozilla.org/MPL/2.0/.
  8. // +build go1.8
  9. package mysql
  10. import (
  11. "database/sql/driver"
  12. "testing"
  13. )
  14. func TestCheckNamedValue(t *testing.T) {
  15. value := driver.NamedValue{Value: ^uint64(0)}
  16. x := &mysqlConn{}
  17. err := x.CheckNamedValue(&value)
  18. if err != nil {
  19. t.Fatal("uint64 high-bit not convertible", err)
  20. }
  21. if value.Value != "18446744073709551615" {
  22. t.Fatalf("uint64 high-bit not converted, got %#v %T", value.Value, value.Value)
  23. }
  24. }