gitlab.com/CoiaPrant/sqlite3@v1.19.1/cgo_test.go (about)

     1  // Copyright 2017 The Sqlite Authors. All rights reserved.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  //go:build ignore || (cgo && cgotest)
     6  // +build ignore cgo,cgotest
     7  
     8  package sqlite // import "gitlab.com/CoiaPrant/sqlite3"
     9  
    10  import (
    11  	"database/sql"
    12  	"os"
    13  	"path/filepath"
    14  	"testing"
    15  
    16  	_ "github.com/mattn/go-sqlite3"
    17  )
    18  
    19  // https://gitlab.com/cznic/sqlite/-/issues/65
    20  func TestIssue65CGo(t *testing.T) {
    21  	tempDir, err := os.MkdirTemp("", "")
    22  	if err != nil {
    23  		t.Fatal(err)
    24  	}
    25  
    26  	defer func() {
    27  		os.RemoveAll(tempDir)
    28  	}()
    29  
    30  	db, err := sql.Open("sqlite3", filepath.Join(tempDir, "testissue65.sqlite"))
    31  	if err != nil {
    32  		t.Fatalf("Failed to open database: %v", err)
    33  	}
    34  
    35  	testIssue65(t, db, false)
    36  }