]> source.dussan.org Git - redmine.git/commitdiff
scm: bazaar: add entry test to unit lib test
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Mon, 17 Sep 2012 10:41:59 +0000 (10:41 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Mon, 17 Sep 2012 10:41:59 +0000 (10:41 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10411 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/unit/lib/redmine/scm/adapters/bazaar_adapter_test.rb

index e100e9d37f3aae2378e76c8184bafc9773a2b826..db325701c71539ad7973d5c1198073abfeb39b12 100644 (file)
@@ -176,6 +176,37 @@ begin
         assert_nil @adapter.revisions(nil, 12345678, 87654321)
       end
 
+      def test_entry
+        entry = @adapter.entry()
+        assert_equal "", entry.path
+        assert_equal "dir", entry.kind
+        entry = @adapter.entry('')
+        assert_equal "", entry.path
+        assert_equal "dir", entry.kind
+        assert_nil @adapter.entry('invalid')
+        assert_nil @adapter.entry('/invalid')
+        assert_nil @adapter.entry('/invalid/')
+        assert_nil @adapter.entry('invalid/invalid')
+        assert_nil @adapter.entry('invalid/invalid/')
+        assert_nil @adapter.entry('/invalid/invalid')
+        assert_nil @adapter.entry('/invalid/invalid/')
+        ["doc-ls.txt", "/doc-ls.txt"].each do |path|
+          entry = @adapter.entry(path, 2)
+          assert_equal "doc-ls.txt", entry.path
+          assert_equal "file", entry.kind
+        end
+        ["directory", "/directory", "/directory/"].each do |path|
+          entry = @adapter.entry(path, 2)
+          assert_equal "directory", entry.path
+          assert_equal "dir", entry.kind
+        end
+        ["directory/document.txt", "/directory/document.txt"].each do |path|
+          entry = @adapter.entry(path, 2)
+          assert_equal "directory/document.txt", entry.path
+          assert_equal "file", entry.kind
+        end
+      end
+
       private
 
       def test_scm_version_for(scm_command_version, version)