From 4df87deabd7028600a2f54fceac8e61ddbbaafb1 Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Tue, 4 Aug 2015 08:27:55 +1000 Subject: [PATCH] Added a test stub. --- samples/errorfs/error_fs.go | 6 ++-- samples/errorfs/error_fs_test.go | 61 ++++++++++++++++++++++++++++++++ 2 files changed, 65 insertions(+), 2 deletions(-) create mode 100644 samples/errorfs/error_fs_test.go diff --git a/samples/errorfs/error_fs.go b/samples/errorfs/error_fs.go index 6e1a2e1..8fe401c 100644 --- a/samples/errorfs/error_fs.go +++ b/samples/errorfs/error_fs.go @@ -15,6 +15,7 @@ package errorfs import ( + "errors" "reflect" "syscall" @@ -36,6 +37,7 @@ type FS interface { SetError(t reflect.Type, err syscall.Errno) } -func New() (fs FS) { - panic("TODO") +func New() (fs FS, err error) { + err = errors.New("TODO") + return } diff --git a/samples/errorfs/error_fs_test.go b/samples/errorfs/error_fs_test.go new file mode 100644 index 0000000..e4f45ef --- /dev/null +++ b/samples/errorfs/error_fs_test.go @@ -0,0 +1,61 @@ +// Copyright 2015 Google Inc. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +package errorfs_test + +import ( + "testing" + + "github.com/jacobsa/fuse/fuseutil" + "github.com/jacobsa/fuse/samples" + "github.com/jacobsa/fuse/samples/errorfs" + . "github.com/jacobsa/ogletest" +) + +func TestErrorFS(t *testing.T) { RunTests(t) } + +//////////////////////////////////////////////////////////////////////// +// Boilerplate +//////////////////////////////////////////////////////////////////////// + +type ErrorFSTest struct { + samples.SampleTest + fs errorfs.FS +} + +func init() { RegisterTestSuite(&ErrorFSTest{}) } + +var _ SetUpInterface = &ErrorFSTest{} +var _ TearDownInterface = &ErrorFSTest{} + +func (t *ErrorFSTest) SetUp(ti *TestInfo) { + var err error + + // Create the file system. + t.fs, err = errorfs.New() + AssertEq(nil, err) + + t.Server = fuseutil.NewFileSystemServer(t.fs) + + // Mount it. + t.SampleTest.SetUp(ti) +} + +//////////////////////////////////////////////////////////////////////// +// Tests +//////////////////////////////////////////////////////////////////////// + +func (t *ErrorFSTest) DoesFoo() { + AssertTrue(false, "TODO") +}