summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorscott Chacon <schacon@agadorsparticus.corp.reactrix.com>2007-11-20 12:08:11 -0800
committerscott Chacon <schacon@agadorsparticus.corp.reactrix.com>2007-11-20 12:08:11 -0800
commit55c3c134c5c19103ed52fbd615d5af351fa9bb34 (patch)
tree97d6964d22bb0e27a10cf753492f3f72bde5116a
parent2cef1e66c395296620225c7ffd77b772c6ad4215 (diff)
downloadthird_party-ruby-git-55c3c134c5c19103ed52fbd615d5af351fa9bb34.zip
third_party-ruby-git-55c3c134c5c19103ed52fbd615d5af351fa9bb34.tar.gz
third_party-ruby-git-55c3c134c5c19103ed52fbd615d5af351fa9bb34.tar.xz
added a test for the logger
-rw-r--r--tests/units/test_logger.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/units/test_logger.rb b/tests/units/test_logger.rb
new file mode 100644
index 0000000..d88f09f
--- /dev/null
+++ b/tests/units/test_logger.rb
@@ -0,0 +1,38 @@
+#!/usr/bin/env ruby
+require 'logger'
+require File.dirname(__FILE__) + '/../test_helper'
+
+class TestLogger < Test::Unit::TestCase
+
+ def setup
+ set_file_paths
+ end
+
+ def test_logger
+ log = Tempfile.new('logfile')
+ log.close
+
+ logger = Logger.new(log.path)
+ logger.level = Logger::DEBUG
+
+ @git = Git.open(@wdir, :log => logger)
+ @git.branches.size
+
+ logc = File.read(log.path)
+ assert(/INFO -- : git branch -a/.match(logc))
+ assert(/DEBUG -- : \* git_grep/.match(logc))
+
+ log = Tempfile.new('logfile')
+ log.close
+ logger = Logger.new(log.path)
+ logger.level = Logger::INFO
+
+ @git = Git.open(@wdir, :log => logger)
+ @git.branches.size
+
+ logc = File.read(log.path)
+ assert(/INFO -- : git branch -a/.match(logc))
+ assert(!/DEBUG -- : \* git_grep/.match(logc))
+ end
+
+end