Repository: groovy
Updated Branches:
  refs/heads/GROOVY_2_5_X c8694703b -> 08a07e3b3


Refine `MemoizeAtMostTest`

(cherry picked from commit b269c84)


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

Branch: refs/heads/GROOVY_2_5_X
Commit: 08a07e3b31d152d1a45ee6cfa5cf4c3c9748ab35
Parents: c869470
Author: danielsun1106 <realblue...@hotmail.com>
Authored: Sat Mar 3 02:32:08 2018 +0800
Committer: danielsun1106 <realblue...@hotmail.com>
Committed: Sat Mar 3 02:33:25 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/08a07e3b/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