[Pkg-bazaar-commits] ./bzr/unstable r963: - add the start of a test for inventory file-id matching

Martin Pool mbp at sourcefrog.net
Fri Apr 10 08:21:36 UTC 2009


------------------------------------------------------------
revno: 963
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Fri 2005-07-22 19:37:53 -0300
message:
  - add the start of a test for inventory file-id matching
added:
  bzrlib/selftest/testinv.py
modified:
  bzrlib/selftest/__init__.py
-------------- next part --------------
=== modified file 'bzrlib/selftest/__init__.py'
--- a/bzrlib/selftest/__init__.py	2005-07-12 01:44:23 +0000
+++ b/bzrlib/selftest/__init__.py	2005-07-22 22:37:53 +0000
@@ -34,6 +34,7 @@
     import bzrlib.selftest.testrevisionnamespaces
     import bzrlib.selftest.testbranch
     import bzrlib.selftest.teststatus
+    import bzrlib.selftest.testinv
     import bzrlib.merge_core
     from doctest import DocTestSuite
     import os
@@ -49,6 +50,7 @@
             
     for m in (bzrlib.selftest.whitebox,
               bzrlib.selftest.versioning,
+              bzrlib.selftest.testinv,
               bzrlib.selftest.testmerge3,
               bzrlib.selftest.testhashcache,
               bzrlib.selftest.teststatus,

=== added file 'bzrlib/selftest/testinv.py'
--- a/bzrlib/selftest/testinv.py	1970-01-01 00:00:00 +0000
+++ b/bzrlib/selftest/testinv.py	2005-07-22 22:37:53 +0000
@@ -0,0 +1,38 @@
+# Copyright (C) 2005 by 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
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+
+from bzrlib.selftest import TestBase
+
+from bzrlib.inventory import Inventory, InventoryEntry
+
+class TestIsWithin(TestBase):
+    def runTest(self):
+        """Test detection of files within selected directories."""
+        inv = Inventory()
+        
+        for args in [('src', 'directory', 'src-id'), 
+                     ('doc', 'directory', 'doc-id'), 
+                     ('src/hello.c', 'file'),
+                     ('src/bye.c', 'file', 'bye-id'),
+                     ('Makefile', 'file')]:
+            inv.add_path(*args)
+            
+        self.assertEqual(inv.path2id('src'), 'src-id')
+        self.assertEqual(inv.path2id('src/bye.c'), 'bye-id')
+        
+        self.assert_('src-id' in inv)
+        
+        
\ No newline at end of file



More information about the Pkg-bazaar-commits mailing list