More tests.

This commit is contained in:
Nuno Cruces
2023-01-26 12:15:34 +00:00
parent 09c7c7af3f
commit 606163010a
5 changed files with 126 additions and 66 deletions

20
.github/coverage.html vendored
View File

@@ -65,7 +65,7 @@
<option value="file4">github.com/ncruces/go-sqlite3/stmt.go (27.2%)</option>
<option value="file5">github.com/ncruces/go-sqlite3/vfs.go (67.4%)</option>
<option value="file5">github.com/ncruces/go-sqlite3/vfs.go (74.7%)</option>
<option value="file6">github.com/ncruces/go-sqlite3/vfs_files.go (70.6%)</option>
@@ -848,7 +848,7 @@ func vfsFullPathname(ctx context.Context, mod api.Module, pVfs, zRelative, nFull
// This might be buggy on Windows (the Windows VFS doesn't try).
<span class="cov8" title="1">siz := uint32(len(abs) + 1)
if siz &gt; nFull </span><span class="cov0" title="0">{
if siz &gt; nFull </span><span class="cov8" title="1">{
return uint32(CANTOPEN_FULLPATH)
}</span>
<span class="cov8" title="1">if zFull == 0 </span><span class="cov0" title="0">{
@@ -873,13 +873,13 @@ func vfsDelete(ctx context.Context, mod api.Module, pVfs, zPath, syncDir uint32)
<span class="cov8" title="1">if err != nil </span><span class="cov0" title="0">{
return uint32(IOERR_DELETE)
}</span>
<span class="cov8" title="1">if syncDir != 0 </span><span class="cov0" title="0">{
<span class="cov8" title="1">if syncDir != 0 </span><span class="cov8" title="1">{
f, err := os.Open(filepath.Dir(path))
if err == nil </span><span class="cov0" title="0">{
if err == nil </span><span class="cov8" title="1">{
err = f.Sync()
f.Close()
}</span>
<span class="cov0" title="0">if err != nil </span><span class="cov0" title="0">{
<span class="cov8" title="1">if err != nil </span><span class="cov0" title="0">{
return uint32(IOERR_DELETE)
}</span>
}
@@ -897,7 +897,7 @@ func vfsAccess(ctx context.Context, mod api.Module, pVfs, zPath uint32, flags Ac
switch </span>{
case flags == ACCESS_EXISTS:<span class="cov8" title="1">
switch </span>{
case err == nil:<span class="cov0" title="0">
case err == nil:<span class="cov8" title="1">
res = 1</span>
case errors.Is(err, fs.ErrNotExist):<span class="cov8" title="1">
res = 0</span>
@@ -905,15 +905,15 @@ func vfsAccess(ctx context.Context, mod api.Module, pVfs, zPath uint32, flags Ac
return uint32(IOERR_ACCESS)</span>
}
case err == nil:<span class="cov0" title="0">
case err == nil:<span class="cov8" title="1">
var want fs.FileMode = syscall.S_IRUSR
if flags == ACCESS_READWRITE </span><span class="cov0" title="0">{
if flags == ACCESS_READWRITE </span><span class="cov8" title="1">{
want |= syscall.S_IWUSR
}</span>
<span class="cov0" title="0">if fi.IsDir() </span><span class="cov0" title="0">{
<span class="cov8" title="1">if fi.IsDir() </span><span class="cov8" title="1">{
want |= syscall.S_IXUSR
}</span>
<span class="cov0" title="0">if fi.Mode()&amp;want == want </span><span class="cov0" title="0">{
<span class="cov8" title="1">if fi.Mode()&amp;want == want </span><span class="cov8" title="1">{
res = 1
}</span> else<span class="cov0" title="0"> {
res = 0

View File

@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="20" role="img" aria-label="coverage: 59.0%"><title>coverage: 59.0%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="108" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="47" height="20" fill="#fe7d37"/><rect width="108" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="315" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">coverage</text><text x="315" y="140" transform="scale(.1)" fill="#fff" textLength="510">coverage</text><text aria-hidden="true" x="835" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="370">59.0%</text><text x="835" y="140" transform="scale(.1)" fill="#fff" textLength="370">59.0%</text></g></svg>
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="108" height="20" role="img" aria-label="coverage: 61.1%"><title>coverage: 61.1%</title><linearGradient id="s" x2="0" y2="100%"><stop offset="0" stop-color="#bbb" stop-opacity=".1"/><stop offset="1" stop-opacity=".1"/></linearGradient><clipPath id="r"><rect width="108" height="20" rx="3" fill="#fff"/></clipPath><g clip-path="url(#r)"><rect width="61" height="20" fill="#555"/><rect x="61" width="47" height="20" fill="#fe7d37"/><rect width="108" height="20" fill="url(#s)"/></g><g fill="#fff" text-anchor="middle" font-family="Verdana,Geneva,DejaVu Sans,sans-serif" text-rendering="geometricPrecision" font-size="110"><text aria-hidden="true" x="315" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="510">coverage</text><text x="315" y="140" transform="scale(.1)" fill="#fff" textLength="510">coverage</text><text aria-hidden="true" x="835" y="150" fill="#010101" fill-opacity=".3" transform="scale(.1)" textLength="370">61.1%</text><text x="835" y="140" transform="scale(.1)" fill="#fff" textLength="370">61.1%</text></g></svg>

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB