At http://bzr.arbash-meinel.com/branches/bzr/1.11/fifo_cache

------------------------------------------------------------
revno: 3890
revision-id: [EMAIL PROTECTED]
parent: [EMAIL PROTECTED]
committer: John Arbash Meinel <[EMAIL PROTECTED]>
branch nick: fifo_cache
timestamp: Tue 2008-12-09 16:00:03 -0600
message:
  Add tests that *adding* an entry also triggers the cleanup code.
=== modified file 'bzrlib/tests/test_fifo_cache.py'
--- a/bzrlib/tests/test_fifo_cache.py   2008-12-09 21:57:36 +0000
+++ b/bzrlib/tests/test_fifo_cache.py   2008-12-09 22:00:03 +0000
@@ -158,11 +158,19 @@
         c[5] = 6 # no cleanup for 5
         self.assertEqual([], log)
         # Adding another key should cleanup 1 & 2
-        c[6] = 7
+        c.add(6, 7, cleanup=logging_cleanup)
         self.assertEqual([(1, 2), (2, 3)], log)
         del log[:]
-        c.clear()
+        # replacing 3 should trigger a cleanup
+        c.add(3, 8, cleanup=logging_cleanup)
         self.assertEqual([(3, 4)], log)
+        del log[:]
+        c[3] = 9
+        self.assertEqual([(3, 8)], log)
+        del log[:]
+        # Clearing everything should call all remaining cleanups
+        c.clear()
+        self.assertEqual([(6, 7)], log)
 
     def test_cleanup_at_deconstruct(self):
         log = []

-- 
bazaar-commits mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/bazaar-commits

Reply via email to