diff options
| author | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2022-09-10 17:33:30 +0200 | 
|---|---|---|
| committer | Gabriel Arakaki Giovanini <mail@gabrielgio.me> | 2022-09-10 17:33:30 +0200 | 
| commit | 3451d56ead6e57f503962b876c89284f1fb73a90 (patch) | |
| tree | 172599f1f3acd77bc918c55403eb78255ced43e6 /storage/storage_fs_test.go | |
| parent | 544bbeeaf836436305cbed87ae1019511de62535 (diff) | |
| download | porg-3451d56ead6e57f503962b876c89284f1fb73a90.tar.gz porg-3451d56ead6e57f503962b876c89284f1fb73a90.tar.bz2 porg-3451d56ead6e57f503962b876c89284f1fb73a90.zip  | |
ref: Create a storage interface
This `Storage` interface will define all the interactions with the
storage system. For now I plan to support native file system through
go's standard library and Nextcloud through *webdav*. So this is the
first step in that direction.
Diffstat (limited to 'storage/storage_fs_test.go')
| -rw-r--r-- | storage/storage_fs_test.go | 29 | 
1 files changed, 29 insertions, 0 deletions
diff --git a/storage/storage_fs_test.go b/storage/storage_fs_test.go new file mode 100644 index 0000000..b746c7e --- /dev/null +++ b/storage/storage_fs_test.go @@ -0,0 +1,29 @@ +package storage + +import ( +	"porg/testutil" +	"testing" +) + +func TestWalk(t *testing.T) { +	fileCount := 1000 +	folder := testutil.CreateFolder() +	files := map[string]struct{}{} +	walkedFiles := map[string]struct{}{} + +	for i := 0; i < fileCount; i++ { +		files[testutil.AppendEmptyFile(folder)] = struct{}{} +	} + +	c := WalkFolder(folder, File) +	for file := range c { +		walkedFiles[file] = struct{}{} +	} + +	for k := range files { +		_, ok := walkedFiles[k] +		if !ok { +			t.Errorf("File %s was not walked", k) +		} +	} +}  | 
