1
0

Get ready for Go1

This commit is contained in:
Patrick Mylund Nielsen 2012-02-12 00:15:25 +01:00
parent 950a5926e8
commit b95b9110a4
3 changed files with 12 additions and 12 deletions

View File

@ -1,7 +0,0 @@
include $(GOROOT)/src/Make.inc
TARG=github.com/pmylund/go-cache
GOFILES=\
cache.go\
include $(GOROOT)/src/Make.pkg

2
README
View File

@ -9,7 +9,7 @@ from downtime quickly.
== Installation
goinstall github.com/pmylund/go-cache
go get github.com/pmylund/go-cache
== Usage

View File

@ -2,7 +2,7 @@ package cache
import (
"bytes"
"os"
"io/ioutil"
"testing"
"time"
)
@ -586,12 +586,20 @@ func TestFileSerialization(t *testing.T) {
tc := New(0, 0)
tc.Add("a", "a", 0)
tc.Add("b", "b", 0)
fname := "_test/cache.dat"
f, err := ioutil.TempFile("", "go-cache-cache.dat")
if err != nil {
t.Fatal("Couldn't create cache file:", err)
}
fname := f.Name()
f.Close()
tc.SaveFile(fname)
oc := New(0, 0)
oc.Add("a", "aa", 0) // this should not be overwritten
oc.LoadFile(fname)
err = oc.LoadFile(fname)
if err != nil {
t.Error(err)
}
a, found := oc.Get("a")
if !found {
t.Error("a was not found")
@ -611,7 +619,6 @@ func TestFileSerialization(t *testing.T) {
if b.(string) != "b" {
t.Error("b is not b")
}
os.Remove(fname)
}
func TestSerializeUnserializable(t *testing.T) {