Repository: lucy Updated Branches: refs/heads/LUCY-282-test-index-go-pt1 [created] 85790f34e
Test RAMFile Go bindings. Project: http://git-wip-us.apache.org/repos/asf/lucy/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/0b2ceea3 Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/0b2ceea3 Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/0b2ceea3 Branch: refs/heads/LUCY-282-test-index-go-pt1 Commit: 0b2ceea35d0bef7f80a83610f1835235d507ebca Parents: 61d4529 Author: Marvin Humphrey <mar...@rectangular.com> Authored: Wed Oct 7 18:25:48 2015 -0700 Committer: Marvin Humphrey <mar...@rectangular.com> Committed: Thu Oct 15 16:02:52 2015 -0700 ---------------------------------------------------------------------- go/lucy/store_test.go | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy/blob/0b2ceea3/go/lucy/store_test.go ---------------------------------------------------------------------- diff --git a/go/lucy/store_test.go b/go/lucy/store_test.go new file mode 100644 index 0000000..640b11f --- /dev/null +++ b/go/lucy/store_test.go @@ -0,0 +1,41 @@ +/* Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You 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 lucy + +import "testing" +import "reflect" + +import "git-wip-us.apache.org/repos/asf/lucy-clownfish.git/runtime/go/clownfish" + +func TestRAMFileBasics(t *testing.T) { + fooBytes := []byte("foo") + contents := clownfish.NewByteBuf(5) + contents.Cat(fooBytes) + ramFile := NewRAMFile(contents, false) + + if ramFile.ReadOnly() { + t.Error("ReadOnly") + } + ramFile.SetReadOnly(true) + if !ramFile.ReadOnly() { + t.Error("SetReadOnly/ReadOnly") + } + + if got := ramFile.GetContents().YieldBlob(); !reflect.DeepEqual(got, fooBytes) { + t.Errorf("GetContents: %v", got) + } +}