pkg/index: util_test.go not an index impl

Change-Id: Iccc1bb43d703ec8a05f30bdd3132058fbdff2f1f
This commit is contained in:
mpl 2016-10-24 18:12:13 +02:00
parent 096493bc13
commit 167bed4277
4 changed files with 15 additions and 5 deletions

View File

@ -123,3 +123,9 @@ func (x *Index) Exp_FixMissingWholeRef(fetcher blob.Fetcher) (err error) {
} }
var Exp_ErrMissingWholeRef = errMissingWholeRef var Exp_ErrMissingWholeRef = errMissingWholeRef
var Exp_KeyRecentPermanode = keyRecentPermanode
func Exp_TypeOfKey(key string) string {
return typeOfKey(key)
}

View File

@ -79,6 +79,7 @@ var (
"export_test.go", "export_test.go",
"index_test.go", "index_test.go",
"keys_test.go", "keys_test.go",
"util_test.go",
} }
// A map is used in hasAllRequiredTests to note which required // A map is used in hasAllRequiredTests to note which required
// tests have been found in a package, by setting the corresponding // tests have been found in a package, by setting the corresponding

View File

@ -14,14 +14,16 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package index package index_test
import ( import (
"testing" "testing"
"camlistore.org/pkg/index"
) )
func TestKeyPrefix(t *testing.T) { func TestKeyPrefix(t *testing.T) {
if g, e := keyRecentPermanode.Prefix("ABC"), "recpn|ABC|"; g != e { if g, e := index.Exp_KeyRecentPermanode.Prefix("ABC"), "recpn|ABC|"; g != e {
t.Errorf("recpn = %q; want %q", g, e) t.Errorf("recpn = %q; want %q", g, e)
} }
} }
@ -37,7 +39,7 @@ func TestTypeOfKey(t *testing.T) {
{"fooo", ""}, {"fooo", ""},
} }
for _, tt := range tests { for _, tt := range tests {
if got := typeOfKey(tt.in); got != tt.want { if got := index.Exp_TypeOfKey(tt.in); got != tt.want {
t.Errorf("typeOfKey(%q) = %q; want %q", tt.in, got, tt.want) t.Errorf("typeOfKey(%q) = %q; want %q", tt.in, got, tt.want)
} }
} }

View File

@ -14,13 +14,14 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
package index package index_test
import ( import (
"testing" "testing"
"time" "time"
"camlistore.org/pkg/blob" "camlistore.org/pkg/blob"
"camlistore.org/pkg/index"
"camlistore.org/pkg/types/camtypes" "camlistore.org/pkg/types/camtypes"
) )
@ -78,7 +79,7 @@ func TestClaimsAttrValue(t *testing.T) {
} }
for i, tt := range tests { for i, tt := range tests {
got := ClaimsAttrValue(claims, tt.attr, tt.t, blob.Ref{}) got := index.ClaimsAttrValue(claims, tt.attr, tt.t, blob.Ref{})
if got != tt.want { if got != tt.want {
t.Errorf("%d. attr %q = %v; want %v", t.Errorf("%d. attr %q = %v; want %v",
i, tt.attr, got, tt.want) i, tt.attr, got, tt.want)