Refactor extensions.

This commit is contained in:
Nuno Cruces
2024-01-03 00:54:30 +00:00
parent fab70ddbec
commit ae850191c8
23 changed files with 491 additions and 256 deletions

View File

@@ -1,24 +0,0 @@
package util
import (
"io/fs"
"os"
)
type OSFS struct{}
func (OSFS) Open(name string) (fs.File, error) {
return os.Open(name)
}
func (OSFS) Stat(name string) (fs.FileInfo, error) {
return os.Stat(name)
}
func (OSFS) ReadDir(name string) ([]fs.DirEntry, error) {
return os.ReadDir(name)
}
func (OSFS) ReadFile(name string) ([]byte, error) {
return os.ReadFile(name)
}

View File

@@ -0,0 +1,15 @@
package util_test
import (
"math"
"testing"
"github.com/ncruces/go-sqlite3/internal/util"
)
func TestUnwrapPointer(t *testing.T) {
p := util.Pointer[float64]{Value: math.Pi}
if got := util.UnwrapPointer(p); got != math.Pi {
t.Errorf("want π, got %v", got)
}
}