From a8648b2868d608103ec332232e316eede6a7dfa1 Mon Sep 17 00:00:00 2001 From: Aaron Jacobs Date: Fri, 20 Mar 2015 11:57:21 +1100 Subject: [PATCH] We're not using byte slices. --- samples/flushfs/flush_fs_test.go | 34 ++++++-------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/samples/flushfs/flush_fs_test.go b/samples/flushfs/flush_fs_test.go index c72b5be..818271e 100644 --- a/samples/flushfs/flush_fs_test.go +++ b/samples/flushfs/flush_fs_test.go @@ -15,8 +15,6 @@ package flushfs_test import ( - "errors" - "fmt" "io" "os" "path" @@ -81,26 +79,6 @@ func (t *FlushFSTest) SetUp(ti *TestInfo) { // Helpers //////////////////////////////////////////////////////////////////////// -// Match byte slices equal to the supplied string. -func byteSliceEq(expected string) Matcher { - pred := func(c interface{}) error { - slice, ok := c.([]byte) - if !ok { - return errors.New("which is not []byte") - } - - if string(slice) != expected { - return fmt.Errorf("which is string \"%s\"", string(slice)) - } - - return nil - } - - return NewMatcher( - pred, - fmt.Sprintf("byte slice equal to string \"%s\"", expected)) -} - // Return a copy of the current contents of t.flushes. // // LOCKS_EXCLUDED(t.mu) @@ -169,7 +147,7 @@ func (t *FlushFSTest) CloseReports_ReadWrite() { AssertEq(nil, err) // Now we should have received the flush operation (but still no fsync). - ExpectThat(t.getFlushes(), ElementsAre(byteSliceEq("taco"))) + ExpectThat(t.getFlushes(), ElementsAre("taco")) ExpectThat(t.getFsyncs(), ElementsAre()) } @@ -196,7 +174,7 @@ func (t *FlushFSTest) CloseReports_ReadOnly() { AssertEq(nil, err) // Now we should have received the flush operation (but still no fsync). - ExpectThat(t.getFlushes(), ElementsAre(byteSliceEq(""))) + ExpectThat(t.getFlushes(), ElementsAre("")) ExpectThat(t.getFsyncs(), ElementsAre()) } @@ -229,7 +207,7 @@ func (t *FlushFSTest) CloseReports_WriteOnly() { AssertEq(nil, err) // Now we should have received the flush operation (but still no fsync). - ExpectThat(t.getFlushes(), ElementsAre(byteSliceEq("taco"))) + ExpectThat(t.getFlushes(), ElementsAre("taco")) ExpectThat(t.getFsyncs(), ElementsAre()) } @@ -262,7 +240,7 @@ func (t *FlushFSTest) CloseReports_MultipleTimes_NonOverlappingFileHandles() { AssertEq(nil, err) // Now we should have received the flush operation (but still no fsync). - AssertThat(t.getFlushes(), ElementsAre(byteSliceEq("taco"))) + AssertThat(t.getFlushes(), ElementsAre("taco")) AssertThat(t.getFsyncs(), ElementsAre()) // Open the file again. @@ -274,7 +252,7 @@ func (t *FlushFSTest) CloseReports_MultipleTimes_NonOverlappingFileHandles() { AssertEq(nil, err) AssertEq(1, n) - AssertThat(t.getFlushes(), ElementsAre(byteSliceEq("taco"))) + AssertThat(t.getFlushes(), ElementsAre("taco")) AssertThat(t.getFsyncs(), ElementsAre()) // Close the file. Now the new contents should be flushed. @@ -282,7 +260,7 @@ func (t *FlushFSTest) CloseReports_MultipleTimes_NonOverlappingFileHandles() { f = nil AssertEq(nil, err) - AssertThat(t.getFlushes(), ElementsAre(byteSliceEq("taco"), byteSliceEq("paco"))) + AssertThat(t.getFlushes(), ElementsAre("taco", "paco")) AssertThat(t.getFsyncs(), ElementsAre()) }