We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Storing a value under the empty string fails silently:
import "testing" import "bytes" import "os" import "github.com/steveyen/gkvlite" func TestSimpleEmptyStore(t *testing.T){ f, err := os.Create("/tmp/test.gkvlite") if err != nil { t.Errorf("Failed to create Storage File: %v",err) } res, err := gkvlite.NewStore(f) if err != nil { t.Errorf("Failed to create Storage Object: %v",err) } db := res.SetCollection("test",nil) key := []byte{} text := []byte("fnord") db.Set(key,text) readback,err := db.Get(key) if err != nil { t.Errorf("Failed to read back %v",err) } if bytes.Compare(text,readback) != 0 { t.Errorf("Failed to read back, got: %v expected: %v",readback,text) } }
The test case fails after returning the empty string instead of the stored value:
--- FAIL: TestSimpleEmptyStore (0.00 seconds) gkvlite_test.go:26: Failed to read back, got: [] expected: [102 110 111 114 100]
The text was updated successfully, but these errors were encountered:
Looks like the provided sample test case isn't checking for the error return value from the Set() invocation.
The Set() implementation in gkvlite is doing the empty key correct check...
https://github.com/steveyen/gkvlite/blob/master/collection.go#L129
Sorry, something went wrong.
No branches or pull requests
Storing a value under the empty string fails silently:
The test case fails after returning the empty string instead of the stored value:
The text was updated successfully, but these errors were encountered: