summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-09-17 10:41:33 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2012-09-17 10:41:33 +0000
commit2da70de1a7b31750f5f6f5e3fcbb5a3ed2d2d19e (patch)
tree9c457094a9b1636358716e121f152d00dc60c1fa /test
parentdd89ce45941f55e444d95bac58c8808782e2e783 (diff)
downloadredmine-2da70de1a7b31750f5f6f5e3fcbb5a3ed2d2d19e.tar.gz
redmine-2da70de1a7b31750f5f6f5e3fcbb5a3ed2d2d19e.zip
scm: git: add entry test to unit lib test
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@10410 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/lib/redmine/scm/adapters/git_adapter_test.rb31
1 files changed, 31 insertions, 0 deletions
diff --git a/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb b/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb
index 6c9e352cb..028701c17 100644
--- a/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb
+++ b/test/unit/lib/redmine/scm/adapters/git_adapter_test.rb
@@ -487,6 +487,37 @@ begin
end
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/')
+ ["README", "/README"].each do |path|
+ entry = @adapter.entry(path, '7234cb2750b63f')
+ assert_equal "README", entry.path
+ assert_equal "file", entry.kind
+ end
+ ["sources", "/sources", "/sources/"].each do |path|
+ entry = @adapter.entry(path, '7234cb2750b63f')
+ assert_equal "sources", entry.path
+ assert_equal "dir", entry.kind
+ end
+ ["sources/watchers_controller.rb", "/sources/watchers_controller.rb"].each do |path|
+ entry = @adapter.entry(path, '7234cb2750b63f')
+ assert_equal "sources/watchers_controller.rb", entry.path
+ assert_equal "file", entry.kind
+ end
+ end
+
def test_path_encoding_default_utf8
adpt1 = Redmine::Scm::Adapters::GitAdapter.new(
REPOSITORY_PATH