http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b002dd0c/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/.gitignore ---------------------------------------------------------------------- diff --git a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/.gitignore b/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/.gitignore deleted file mode 100644 index bf90dfd..0000000 --- a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -*.db -*.exe -*.dll
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b002dd0c/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/.travis.yml ---------------------------------------------------------------------- diff --git a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/.travis.yml b/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/.travis.yml deleted file mode 100644 index 03d626f..0000000 --- a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/.travis.yml +++ /dev/null @@ -1,8 +0,0 @@ -language: go -go: - - tip -before_install: - - go get github.com/mattn/goveralls - - go get golang.org/x/tools/cmd/cover -script: - - $HOME/gopath/bin/goveralls -repotoken 3qJVUE0iQwqnCbmNcDsjYu1nh4J4KIFXx http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b002dd0c/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/LICENSE ---------------------------------------------------------------------- diff --git a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/LICENSE b/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/LICENSE deleted file mode 100644 index ca458bb..0000000 --- a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2014 Yasuhiro Matsumoto - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b002dd0c/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/README.md ---------------------------------------------------------------------- diff --git a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/README.md b/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/README.md deleted file mode 100644 index d69e305..0000000 --- a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/README.md +++ /dev/null @@ -1,75 +0,0 @@ -go-sqlite3 -========== - -[![Build Status](https://travis-ci.org/mattn/go-sqlite3.svg?branch=master)](https://travis-ci.org/mattn/go-sqlite3) -[![Coverage Status](https://coveralls.io/repos/mattn/go-sqlite3/badge.svg?branch=master)](https://coveralls.io/r/mattn/go-sqlite3?branch=master) -[![GoDoc](https://godoc.org/github.com/mattn/go-sqlite3?status.svg)](http://godoc.org/github.com/mattn/go-sqlite3) - -Description ------------ - -sqlite3 driver conforming to the built-in database/sql interface - -Installation ------------- - -This package can be installed with the go get command: - - go get github.com/mattn/go-sqlite3 - -_go-sqlite3_ is *cgo* package. -If you want to build your app using go-sqlite3, you need gcc. -However, if you install _go-sqlite3_ with `go install github.com/mattn/go-sqlite3`, you don't need gcc to build your app anymore. - -Documentation -------------- - -API documentation can be found here: http://godoc.org/github.com/mattn/go-sqlite3 - -Examples can be found under the `./_example` directory - -FAQ ---- - -* Want to build go-sqlite3 with libsqlite3 on my linux. - - Use `go build --tags "libsqlite3 linux"` - -* Want to build go-sqlite3 with icu extension. - - Use `go build --tags "icu"` - -* Can't build go-sqlite3 on windows 64bit. - - > Probably, you are using go 1.0, go1.0 has a problem when it comes to compiling/linking on windows 64bit. - > See: https://github.com/mattn/go-sqlite3/issues/27 - -* Getting insert error while query is opened. - - > You can pass some arguments into the connection string, for example, a URI. - > See: https://github.com/mattn/go-sqlite3/issues/39 - -* Do you want to cross compile? mingw on Linux or Mac? - - > See: https://github.com/mattn/go-sqlite3/issues/106 - > See also: http://www.limitlessfx.com/cross-compile-golang-app-for-windows-from-linux.html - -* Want to get time.Time with current locale - - Use `loc=auto` in SQLite3 filename schema like `file:foo.db?loc=auto`. - -License -------- - -MIT: http://mattn.mit-license.org/2012 - -sqlite3-binding.c, sqlite3-binding.h, sqlite3ext.h - -The -binding suffix was added to avoid build failures under gccgo. - -In this repository, those files are an amalgamation of code that was copied from SQLite3. The license of that code is the same as the license of SQLite3. - -Author ------- - -Yasuhiro Matsumoto (a.k.a mattn) http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b002dd0c/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/backup.go ---------------------------------------------------------------------- diff --git a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/backup.go b/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/backup.go deleted file mode 100644 index 3807c60..0000000 --- a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/backup.go +++ /dev/null @@ -1,70 +0,0 @@ -// Copyright (C) 2014 Yasuhiro Matsumoto <mattn...@gmail.com>. -// -// Use of this source code is governed by an MIT-style -// license that can be found in the LICENSE file. - -package sqlite3 - -/* -#include <sqlite3-binding.h> -#include <stdlib.h> -*/ -import "C" -import ( - "runtime" - "unsafe" -) - -type SQLiteBackup struct { - b *C.sqlite3_backup -} - -func (c *SQLiteConn) Backup(dest string, conn *SQLiteConn, src string) (*SQLiteBackup, error) { - destptr := C.CString(dest) - defer C.free(unsafe.Pointer(destptr)) - srcptr := C.CString(src) - defer C.free(unsafe.Pointer(srcptr)) - - if b := C.sqlite3_backup_init(c.db, destptr, conn.db, srcptr); b != nil { - bb := &SQLiteBackup{b: b} - runtime.SetFinalizer(bb, (*SQLiteBackup).Finish) - return bb, nil - } - return nil, c.lastError() -} - -// Backs up for one step. Calls the underlying `sqlite3_backup_step` function. -// This function returns a boolean indicating if the backup is done and -// an error signalling any other error. Done is returned if the underlying C -// function returns SQLITE_DONE (Code 101) -func (b *SQLiteBackup) Step(p int) (bool, error) { - ret := C.sqlite3_backup_step(b.b, C.int(p)) - if ret == C.SQLITE_DONE { - return true, nil - } else if ret != 0 && ret != C.SQLITE_LOCKED && ret != C.SQLITE_BUSY { - return false, Error{Code: ErrNo(ret)} - } - return false, nil -} - -func (b *SQLiteBackup) Remaining() int { - return int(C.sqlite3_backup_remaining(b.b)) -} - -func (b *SQLiteBackup) PageCount() int { - return int(C.sqlite3_backup_pagecount(b.b)) -} - -func (b *SQLiteBackup) Finish() error { - return b.Close() -} - -func (b *SQLiteBackup) Close() error { - ret := C.sqlite3_backup_finish(b.b) - if ret != 0 { - return Error{Code: ErrNo(ret)} - } - b.b = nil - runtime.SetFinalizer(b, nil) - return nil -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b002dd0c/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/callback.go ---------------------------------------------------------------------- diff --git a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/callback.go b/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/callback.go deleted file mode 100644 index e2bf3c6..0000000 --- a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/callback.go +++ /dev/null @@ -1,336 +0,0 @@ -// Copyright (C) 2014 Yasuhiro Matsumoto <mattn...@gmail.com>. -// -// Use of this source code is governed by an MIT-style -// license that can be found in the LICENSE file. - -package sqlite3 - -// You can't export a Go function to C and have definitions in the C -// preamble in the same file, so we have to have callbackTrampoline in -// its own file. Because we need a separate file anyway, the support -// code for SQLite custom functions is in here. - -/* -#include <sqlite3-binding.h> -#include <stdlib.h> - -void _sqlite3_result_text(sqlite3_context* ctx, const char* s); -void _sqlite3_result_blob(sqlite3_context* ctx, const void* b, int l); -*/ -import "C" - -import ( - "errors" - "fmt" - "math" - "reflect" - "sync" - "unsafe" -) - -//export callbackTrampoline -func callbackTrampoline(ctx *C.sqlite3_context, argc int, argv **C.sqlite3_value) { - args := (*[(math.MaxInt32 - 1) / unsafe.Sizeof((*C.sqlite3_value)(nil))]*C.sqlite3_value)(unsafe.Pointer(argv))[:argc:argc] - fi := lookupHandle(uintptr(C.sqlite3_user_data(ctx))).(*functionInfo) - fi.Call(ctx, args) -} - -//export stepTrampoline -func stepTrampoline(ctx *C.sqlite3_context, argc int, argv **C.sqlite3_value) { - args := (*[(math.MaxInt32 - 1) / unsafe.Sizeof((*C.sqlite3_value)(nil))]*C.sqlite3_value)(unsafe.Pointer(argv))[:argc:argc] - ai := lookupHandle(uintptr(C.sqlite3_user_data(ctx))).(*aggInfo) - ai.Step(ctx, args) -} - -//export doneTrampoline -func doneTrampoline(ctx *C.sqlite3_context) { - handle := uintptr(C.sqlite3_user_data(ctx)) - ai := lookupHandle(handle).(*aggInfo) - ai.Done(ctx) -} - -// Use handles to avoid passing Go pointers to C. - -type handleVal struct { - db *SQLiteConn - val interface{} -} - -var handleLock sync.Mutex -var handleVals = make(map[uintptr]handleVal) -var handleIndex uintptr = 100 - -func newHandle(db *SQLiteConn, v interface{}) uintptr { - handleLock.Lock() - defer handleLock.Unlock() - i := handleIndex - handleIndex++ - handleVals[i] = handleVal{db, v} - return i -} - -func lookupHandle(handle uintptr) interface{} { - handleLock.Lock() - defer handleLock.Unlock() - r, ok := handleVals[handle] - if !ok { - if handle >= 100 && handle < handleIndex { - panic("deleted handle") - } else { - panic("invalid handle") - } - } - return r.val -} - -func deleteHandles(db *SQLiteConn) { - handleLock.Lock() - defer handleLock.Unlock() - for handle, val := range handleVals { - if val.db == db { - delete(handleVals, handle) - } - } -} - -// This is only here so that tests can refer to it. -type callbackArgRaw C.sqlite3_value - -type callbackArgConverter func(*C.sqlite3_value) (reflect.Value, error) - -type callbackArgCast struct { - f callbackArgConverter - typ reflect.Type -} - -func (c callbackArgCast) Run(v *C.sqlite3_value) (reflect.Value, error) { - val, err := c.f(v) - if err != nil { - return reflect.Value{}, err - } - if !val.Type().ConvertibleTo(c.typ) { - return reflect.Value{}, fmt.Errorf("cannot convert %s to %s", val.Type(), c.typ) - } - return val.Convert(c.typ), nil -} - -func callbackArgInt64(v *C.sqlite3_value) (reflect.Value, error) { - if C.sqlite3_value_type(v) != C.SQLITE_INTEGER { - return reflect.Value{}, fmt.Errorf("argument must be an INTEGER") - } - return reflect.ValueOf(int64(C.sqlite3_value_int64(v))), nil -} - -func callbackArgBool(v *C.sqlite3_value) (reflect.Value, error) { - if C.sqlite3_value_type(v) != C.SQLITE_INTEGER { - return reflect.Value{}, fmt.Errorf("argument must be an INTEGER") - } - i := int64(C.sqlite3_value_int64(v)) - val := false - if i != 0 { - val = true - } - return reflect.ValueOf(val), nil -} - -func callbackArgFloat64(v *C.sqlite3_value) (reflect.Value, error) { - if C.sqlite3_value_type(v) != C.SQLITE_FLOAT { - return reflect.Value{}, fmt.Errorf("argument must be a FLOAT") - } - return reflect.ValueOf(float64(C.sqlite3_value_double(v))), nil -} - -func callbackArgBytes(v *C.sqlite3_value) (reflect.Value, error) { - switch C.sqlite3_value_type(v) { - case C.SQLITE_BLOB: - l := C.sqlite3_value_bytes(v) - p := C.sqlite3_value_blob(v) - return reflect.ValueOf(C.GoBytes(p, l)), nil - case C.SQLITE_TEXT: - l := C.sqlite3_value_bytes(v) - c := unsafe.Pointer(C.sqlite3_value_text(v)) - return reflect.ValueOf(C.GoBytes(c, l)), nil - default: - return reflect.Value{}, fmt.Errorf("argument must be BLOB or TEXT") - } -} - -func callbackArgString(v *C.sqlite3_value) (reflect.Value, error) { - switch C.sqlite3_value_type(v) { - case C.SQLITE_BLOB: - l := C.sqlite3_value_bytes(v) - p := (*C.char)(C.sqlite3_value_blob(v)) - return reflect.ValueOf(C.GoStringN(p, l)), nil - case C.SQLITE_TEXT: - c := (*C.char)(unsafe.Pointer(C.sqlite3_value_text(v))) - return reflect.ValueOf(C.GoString(c)), nil - default: - return reflect.Value{}, fmt.Errorf("argument must be BLOB or TEXT") - } -} - -func callbackArgGeneric(v *C.sqlite3_value) (reflect.Value, error) { - switch C.sqlite3_value_type(v) { - case C.SQLITE_INTEGER: - return callbackArgInt64(v) - case C.SQLITE_FLOAT: - return callbackArgFloat64(v) - case C.SQLITE_TEXT: - return callbackArgString(v) - case C.SQLITE_BLOB: - return callbackArgBytes(v) - case C.SQLITE_NULL: - // Interpret NULL as a nil byte slice. - var ret []byte - return reflect.ValueOf(ret), nil - default: - panic("unreachable") - } -} - -func callbackArg(typ reflect.Type) (callbackArgConverter, error) { - switch typ.Kind() { - case reflect.Interface: - if typ.NumMethod() != 0 { - return nil, errors.New("the only supported interface type is interface{}") - } - return callbackArgGeneric, nil - case reflect.Slice: - if typ.Elem().Kind() != reflect.Uint8 { - return nil, errors.New("the only supported slice type is []byte") - } - return callbackArgBytes, nil - case reflect.String: - return callbackArgString, nil - case reflect.Bool: - return callbackArgBool, nil - case reflect.Int64: - return callbackArgInt64, nil - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Int, reflect.Uint: - c := callbackArgCast{callbackArgInt64, typ} - return c.Run, nil - case reflect.Float64: - return callbackArgFloat64, nil - case reflect.Float32: - c := callbackArgCast{callbackArgFloat64, typ} - return c.Run, nil - default: - return nil, fmt.Errorf("don't know how to convert to %s", typ) - } -} - -func callbackConvertArgs(argv []*C.sqlite3_value, converters []callbackArgConverter, variadic callbackArgConverter) ([]reflect.Value, error) { - var args []reflect.Value - - if len(argv) < len(converters) { - return nil, fmt.Errorf("function requires at least %d arguments", len(converters)) - } - - for i, arg := range argv[:len(converters)] { - v, err := converters[i](arg) - if err != nil { - return nil, err - } - args = append(args, v) - } - - if variadic != nil { - for _, arg := range argv[len(converters):] { - v, err := variadic(arg) - if err != nil { - return nil, err - } - args = append(args, v) - } - } - return args, nil -} - -type callbackRetConverter func(*C.sqlite3_context, reflect.Value) error - -func callbackRetInteger(ctx *C.sqlite3_context, v reflect.Value) error { - switch v.Type().Kind() { - case reflect.Int64: - case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Int, reflect.Uint: - v = v.Convert(reflect.TypeOf(int64(0))) - case reflect.Bool: - b := v.Interface().(bool) - if b { - v = reflect.ValueOf(int64(1)) - } else { - v = reflect.ValueOf(int64(0)) - } - default: - return fmt.Errorf("cannot convert %s to INTEGER", v.Type()) - } - - C.sqlite3_result_int64(ctx, C.sqlite3_int64(v.Interface().(int64))) - return nil -} - -func callbackRetFloat(ctx *C.sqlite3_context, v reflect.Value) error { - switch v.Type().Kind() { - case reflect.Float64: - case reflect.Float32: - v = v.Convert(reflect.TypeOf(float64(0))) - default: - return fmt.Errorf("cannot convert %s to FLOAT", v.Type()) - } - - C.sqlite3_result_double(ctx, C.double(v.Interface().(float64))) - return nil -} - -func callbackRetBlob(ctx *C.sqlite3_context, v reflect.Value) error { - if v.Type().Kind() != reflect.Slice || v.Type().Elem().Kind() != reflect.Uint8 { - return fmt.Errorf("cannot convert %s to BLOB", v.Type()) - } - i := v.Interface() - if i == nil || len(i.([]byte)) == 0 { - C.sqlite3_result_null(ctx) - } else { - bs := i.([]byte) - C._sqlite3_result_blob(ctx, unsafe.Pointer(&bs[0]), C.int(len(bs))) - } - return nil -} - -func callbackRetText(ctx *C.sqlite3_context, v reflect.Value) error { - if v.Type().Kind() != reflect.String { - return fmt.Errorf("cannot convert %s to TEXT", v.Type()) - } - C._sqlite3_result_text(ctx, C.CString(v.Interface().(string))) - return nil -} - -func callbackRet(typ reflect.Type) (callbackRetConverter, error) { - switch typ.Kind() { - case reflect.Slice: - if typ.Elem().Kind() != reflect.Uint8 { - return nil, errors.New("the only supported slice type is []byte") - } - return callbackRetBlob, nil - case reflect.String: - return callbackRetText, nil - case reflect.Bool, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Int, reflect.Uint: - return callbackRetInteger, nil - case reflect.Float32, reflect.Float64: - return callbackRetFloat, nil - default: - return nil, fmt.Errorf("don't know how to convert to %s", typ) - } -} - -func callbackError(ctx *C.sqlite3_context, err error) { - cstr := C.CString(err.Error()) - defer C.free(unsafe.Pointer(cstr)) - C.sqlite3_result_error(ctx, cstr, -1) -} - -// Test support code. Tests are not allowed to import "C", so we can't -// declare any functions that use C.sqlite3_value. -func callbackSyntheticForTests(v reflect.Value, err error) callbackArgConverter { - return func(*C.sqlite3_value) (reflect.Value, error) { - return v, err - } -} http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/b002dd0c/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/callback_test.go ---------------------------------------------------------------------- diff --git a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/callback_test.go b/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/callback_test.go deleted file mode 100644 index 5c61f44..0000000 --- a/newt/Godeps/_workspace/src/github.com/mattn/go-sqlite3/callback_test.go +++ /dev/null @@ -1,97 +0,0 @@ -package sqlite3 - -import ( - "errors" - "math" - "reflect" - "testing" -) - -func TestCallbackArgCast(t *testing.T) { - intConv := callbackSyntheticForTests(reflect.ValueOf(int64(math.MaxInt64)), nil) - floatConv := callbackSyntheticForTests(reflect.ValueOf(float64(math.MaxFloat64)), nil) - errConv := callbackSyntheticForTests(reflect.Value{}, errors.New("test")) - - tests := []struct { - f callbackArgConverter - o reflect.Value - }{ - {intConv, reflect.ValueOf(int8(-1))}, - {intConv, reflect.ValueOf(int16(-1))}, - {intConv, reflect.ValueOf(int32(-1))}, - {intConv, reflect.ValueOf(uint8(math.MaxUint8))}, - {intConv, reflect.ValueOf(uint16(math.MaxUint16))}, - {intConv, reflect.ValueOf(uint32(math.MaxUint32))}, - // Special case, int64->uint64 is only 1<<63 - 1, not 1<<64 - 1 - {intConv, reflect.ValueOf(uint64(math.MaxInt64))}, - {floatConv, reflect.ValueOf(float32(math.Inf(1)))}, - } - - for _, test := range tests { - conv := callbackArgCast{test.f, test.o.Type()} - val, err := conv.Run(nil) - if err != nil { - t.Errorf("Couldn't convert to %s: %s", test.o.Type(), err) - } else if !reflect.DeepEqual(val.Interface(), test.o.Interface()) { - t.Errorf("Unexpected result from converting to %s: got %v, want %v", test.o.Type(), val.Interface(), test.o.Interface()) - } - } - - conv := callbackArgCast{errConv, reflect.TypeOf(int8(0))} - _, err := conv.Run(nil) - if err == nil { - t.Errorf("Expected error during callbackArgCast, but got none") - } -} - -func TestCallbackConverters(t *testing.T) { - tests := []struct { - v interface{} - err bool - }{ - // Unfortunately, we can't tell which converter was returned, - // but we can at least check which types can be converted. - {[]byte{0}, false}, - {"text", false}, - {true, false}, - {int8(0), false}, - {int16(0), false}, - {int32(0), false}, - {int64(0), false}, - {uint8(0), false}, - {uint16(0), false}, - {uint32(0), false}, - {uint64(0), false}, - {int(0), false}, - {uint(0), false}, - {float64(0), false}, - {float32(0), false}, - - {func() {}, true}, - {complex64(complex(0, 0)), true}, - {complex128(complex(0, 0)), true}, - {struct{}{}, true}, - {map[string]string{}, true}, - {[]string{}, true}, - {(*int8)(nil), true}, - {make(chan int), true}, - } - - for _, test := range tests { - _, err := callbackArg(reflect.TypeOf(test.v)) - if test.err && err == nil { - t.Errorf("Expected an error when converting %s, got no error", reflect.TypeOf(test.v)) - } else if !test.err && err != nil { - t.Errorf("Expected converter when converting %s, got error: %s", reflect.TypeOf(test.v), err) - } - } - - for _, test := range tests { - _, err := callbackRet(reflect.TypeOf(test.v)) - if test.err && err == nil { - t.Errorf("Expected an error when converting %s, got no error", reflect.TypeOf(test.v)) - } else if !test.err && err != nil { - t.Errorf("Expected converter when converting %s, got error: %s", reflect.TypeOf(test.v), err) - } - } -}