Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable the load extension API #39

Merged
merged 14 commits into from
Aug 25, 2018
Prev Previous commit
check and report errors properly in test
  • Loading branch information
ksshannon committed Aug 25, 2018
commit f16167a117e5f4ed3f15700ab7fa4608cbbef7ff
26 changes: 7 additions & 19 deletions extension_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,22 +29,6 @@ import (

const (
extCode = `
/*
** Copyright (c) 2018 David Crawshaw <david@zentus.com>
**
** Permission to use, copy, modify, and distribute this software for any
** purpose with or without fee is hereby granted, provided that the above
** copyright notice and this permission notice appear in all copies.
**
** THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
** WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
** MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
** ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
** WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
** ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
** OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/

#include "sqlite3ext.h"
SQLITE_EXTENSION_INIT1

Expand Down Expand Up @@ -84,8 +68,12 @@ func TestLoadExtension(t *testing.T) {
if err != nil {
t.Fatal(err)
}
io.Copy(fout, strings.NewReader(extCode))
fout.Close()
if _, err = io.Copy(fout, strings.NewReader(extCode)); err != nil {
t.Fatal(err)
}
if err = fout.Close(); err != nil {
t.Error(err)
}
include, err := os.Getwd()
if err != nil {
t.Fatal(err)
Expand Down Expand Up @@ -116,7 +104,7 @@ func TestLoadExtension(t *testing.T) {
defer func() {
err := c.Close()
if err != nil {
t.Error(nil)
t.Error(err)
}
}()
libPath := filepath.Join(tmpdir, args[len(args)-1])
Expand Down