Rev 4730: Start working on some direct dirstate tests. in http://bazaar.launchpad.net/~jameinel/bzr/2.0.4-dirstate-set-root-504390

John Arbash Meinel john at arbash-meinel.com
Mon Jan 11 23:15:04 GMT 2010


At http://bazaar.launchpad.net/~jameinel/bzr/2.0.4-dirstate-set-root-504390

------------------------------------------------------------
revno: 4730
revision-id: john at arbash-meinel.com-20100111231447-6qz31kgw07f3450d
parent: john at arbash-meinel.com-20100111230325-5wu3gkcstmlibign
committer: John Arbash Meinel <john at arbash-meinel.com>
branch nick: 2.0.4-dirstate-set-root-504390
timestamp: Mon 2010-01-11 17:14:47 -0600
message:
  Start working on some direct dirstate tests.
  
  However, this doesn't seem to be showing the bug that I'm seeing
  elsewhere, so maybe I'm looking in the wrong place.
-------------- next part --------------
=== modified file 'bzrlib/tests/test_dirstate.py'
--- a/bzrlib/tests/test_dirstate.py	2009-08-17 03:33:56 +0000
+++ b/bzrlib/tests/test_dirstate.py	2010-01-11 23:14:47 +0000
@@ -1,4 +1,4 @@
-# Copyright (C) 2006, 2007 Canonical Ltd
+# Copyright (C) 2006, 2007, 2008, 2009, 2010 Canonical Ltd
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -873,15 +873,23 @@
         state = dirstate.DirState.initialize('dirstate')
         try:
             # check precondition to be sure the state does change appropriately.
-            self.assertEqual(
-                [(('', '', 'TREE_ROOT'), [('d', '', 0, False,
-                   'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')])],
-                list(state._iter_entries()))
+            root_entry = (('', '', 'TREE_ROOT'), [('d', '', 0, False, 'x'*32)])
+            self.assertEqual([root_entry], list(state._iter_entries()))
+            self.assertEqual(root_entry, state._get_entry(0, path_utf8=''))
+            self.assertEqual(root_entry,
+                             state._get_entry(0, fileid_utf8='TREE_ROOT'))
+            self.assertEqual((None, None),
+                             state._get_entry(0, fileid_utf8='foobarbaz'))
             state.set_path_id('', 'foobarbaz')
-            expected_rows = [
-                (('', '', 'foobarbaz'), [('d', '', 0, False,
-                   'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx')])]
+            new_root_entry = (('', '', 'foobarbaz'),
+                              [('d', '', 0, False, 'x'*32)])
+            expected_rows = [new_root_entry]
             self.assertEqual(expected_rows, list(state._iter_entries()))
+            self.assertEqual(new_root_entry, state._get_entry(0, path_utf8=''))
+            self.assertEqual(new_root_entry, 
+                             state._get_entry(0, fileid_utf8='foobarbaz'))
+            self.assertEqual((None, None),
+                             state._get_entry(0, fileid_utf8='TREE_ROOT'))
             # should work across save too
             state.save()
         finally:



More information about the bazaar-commits mailing list