Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Levin Zimmermann
go-fuse
Commits
ec443730
Commit
ec443730
authored
Sep 01, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Zipfs: discover testdata location using runtime.Caller()
parent
6d5f84b0
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
5 deletions
+13
-5
zipfs/multizip_test.go
zipfs/multizip_test.go
+1
-2
zipfs/zipfs_test.go
zipfs/zipfs_test.go
+12
-3
No files found.
zipfs/multizip_test.go
View file @
ec443730
...
@@ -50,8 +50,7 @@ func TestMultiZipFs(t *testing.T) {
...
@@ -50,8 +50,7 @@ func TestMultiZipFs(t *testing.T) {
mountPoint
,
cleanup
:=
setupMzfs
()
mountPoint
,
cleanup
:=
setupMzfs
()
defer
cleanup
()
defer
cleanup
()
wd
,
err
:=
os
.
Getwd
()
zipFile
:=
testZipFile
()
zipFile
:=
wd
+
"/test.zip"
entries
,
err
:=
ioutil
.
ReadDir
(
mountPoint
)
entries
,
err
:=
ioutil
.
ReadDir
(
mountPoint
)
CheckSuccess
(
err
)
CheckSuccess
(
err
)
...
...
zipfs/zipfs_test.go
View file @
ec443730
...
@@ -4,13 +4,22 @@ import (
...
@@ -4,13 +4,22 @@ import (
"github.com/hanwen/go-fuse/fuse"
"github.com/hanwen/go-fuse/fuse"
"io/ioutil"
"io/ioutil"
"os"
"os"
"path/filepath"
"runtime"
"testing"
"testing"
)
)
func
testZipFile
()
string
{
_
,
file
,
_
,
ok
:=
runtime
.
Caller
(
0
)
if
!
ok
{
panic
(
"need runtime.Caller()'s file name to discover testdata"
)
}
dir
,
_
:=
filepath
.
Split
(
file
)
return
filepath
.
Join
(
dir
,
"test.zip"
)
}
func
setupZipfs
()
(
mountPoint
string
,
cleanup
func
())
{
func
setupZipfs
()
(
mountPoint
string
,
cleanup
func
())
{
wd
,
err
:=
os
.
Getwd
()
zfs
,
err
:=
NewArchiveFileSystem
(
testZipFile
())
CheckSuccess
(
err
)
zfs
,
err
:=
NewArchiveFileSystem
(
wd
+
"/test.zip"
)
CheckSuccess
(
err
)
CheckSuccess
(
err
)
mountPoint
=
fuse
.
MakeTempDir
()
mountPoint
=
fuse
.
MakeTempDir
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment