1
0
mirror of https://github.com/kataras/iris.git synced 2026-01-23 11:56:00 +00:00

a bit linting and some tests are online again

Former-commit-id: bd5463a169a36b078dba1c1b6e7dd3ffbd627617
This commit is contained in:
kataras
2017-06-10 03:31:50 +03:00
parent f747c682b9
commit c4f5fae561
21 changed files with 522 additions and 42 deletions

View File

@@ -1,3 +1,4 @@
// white-box testing
package memstore
import (
@@ -91,3 +92,21 @@ func TestImmutable(t *testing.T) {
t.Fatalf("expected objp to be immutable but caller was able to change its value")
}
}
func TestImmutableSetOnlyWithSetImmutable(t *testing.T) {
var p Store
p.SetImmutable("objp", &myTestObject{"value"})
p.Set("objp", &myTestObject{"modified"})
vObjP := p.Get("objp").(myTestObject)
if vObjP.name == "modified" {
t.Fatalf("caller should not be able to change the immutable entry with a simple `Set`")
}
p.SetImmutable("objp", &myTestObject{"value with SetImmutable"})
vvObjP := p.Get("objp").(myTestObject)
if vvObjP.name != "value with SetImmutable" {
t.Fatalf("caller should be able to change the immutable entry with a `SetImmutable`")
}
}