Repository: groovy
Updated Branches:
  refs/heads/master a466e7c03 -> b269c8418


Refine `MemoizeAtMostTest`


Project: http://git-wip-us.apache.org/repos/asf/groovy/repo
Commit: http://git-wip-us.apache.org/repos/asf/groovy/commit/b269c841
Tree: http://git-wip-us.apache.org/repos/asf/groovy/tree/b269c841
Diff: http://git-wip-us.apache.org/repos/asf/groovy/diff/b269c841

Branch: refs/heads/master
Commit: b269c8418acd4c53b70854dc0b964261e3b07e54
Parents: a466e7c
Author: danielsun1106 <realblue...@hotmail.com>
Authored: Sat Mar 3 02:32:08 2018 +0800
Committer: danielsun1106 <realblue...@hotmail.com>
Committed: Sat Mar 3 02:32:08 2018 +0800

----------------------------------------------------------------------
 .../org/codehaus/groovy/runtime/memoize/MemoizeAtMostTest.groovy  | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/groovy/blob/b269c841/src/test/org/codehaus/groovy/runtime/memoize/MemoizeAtMostTest.groovy
----------------------------------------------------------------------
diff --git 
a/src/test/org/codehaus/groovy/runtime/memoize/MemoizeAtMostTest.groovy 
b/src/test/org/codehaus/groovy/runtime/memoize/MemoizeAtMostTest.groovy
index 23279c6..6d727ae 100644
--- a/src/test/org/codehaus/groovy/runtime/memoize/MemoizeAtMostTest.groovy
+++ b/src/test/org/codehaus/groovy/runtime/memoize/MemoizeAtMostTest.groovy
@@ -81,6 +81,7 @@ public class MemoizeAtMostTest extends 
AbstractMemoizeTestCase {
         Closure mem = cl.memoizeAtMost(3)
         [4, 5, 6, 4, 5, 6, 4, 5, 6, 4, 5, 6].collect { num -> Thread.start { 
mem(num) } }*.join()
 
-        assert 3 == cnt.get()
+        int c = cnt.get()
+        assert 3 <= c && c <= 6  // cached result may be GCed due to 
SoftReference, so `c` may be greater than 3(in most cases, its value is 3)
     }
 }

Reply via email to