Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go-fuse
Commits
16ee6060
Commit
16ee6060
authored
Sep 22, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make TestTimedCache() prettier.
parent
0e90317c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
unionfs/timedcache_test.go
unionfs/timedcache_test.go
+6
-6
No files found.
unionfs/timedcache_test.go
View file @
16ee6060
...
...
@@ -10,7 +10,7 @@ import (
var
_
=
fmt
.
Print
var
_
=
log
.
Print
func
TestTimed
Int
Cache
(
t
*
testing
.
T
)
{
func
TestTimedCache
(
t
*
testing
.
T
)
{
fetchCount
:=
0
fetch
:=
func
(
n
string
)
interface
{}
{
fetchCount
++
...
...
@@ -24,10 +24,10 @@ func TestTimedIntCache(t *testing.T) {
cache
:=
NewTimedCache
(
fetch
,
ttl
)
v
:=
cache
.
Get
(
"n"
)
.
(
*
int
)
if
*
v
!=
int
(
'n'
)
{
t
.
Error
(
"value mismatch"
,
v
)
t
.
Error
f
(
"value mismatch: got %d, want %d"
,
*
v
,
int
(
'n'
)
)
}
if
fetchCount
!=
1
{
t
.
Error
(
"fetch count mismatch
"
,
fetchCount
)
t
.
Error
f
(
"fetch count mismatch: got %d want 1
"
,
fetchCount
)
}
// The cache update is async.
...
...
@@ -35,11 +35,11 @@ func TestTimedIntCache(t *testing.T) {
w
:=
cache
.
Get
(
"n"
)
if
v
!=
w
{
t
.
Error
(
"Huh, inconsistent."
)
t
.
Error
f
(
"Huh, inconsistent: 1st = %v != 2nd = %v"
,
v
,
w
)
}
if
fetchCount
>
1
{
t
.
Error
(
"fetch count fail.
"
,
fetchCount
)
t
.
Error
f
(
"fetch count fail: %d > 1
"
,
fetchCount
)
}
time
.
Sleep
(
ttl
*
2
)
...
...
@@ -47,6 +47,6 @@ func TestTimedIntCache(t *testing.T) {
w
=
cache
.
Get
(
"n"
)
if
fetchCount
==
1
{
t
.
Error
(
"
d
id not fetch again. Purge unsuccessful?"
)
t
.
Error
(
"
D
id not fetch again. Purge unsuccessful?"
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment