mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	* ext/syslog/test.rb: Syslog.close should raise RuntimeError when
not opened.
* ext/syslog/test.rb: Syslog.{ident,options,facility,mask} should
  all return nil when not opened.
* ext/syslog/test.rb: Change back the output format of inspect().
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3094 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
			
			
This commit is contained in:
		
							parent
							
								
									ce0fd8c523
								
							
						
					
					
						commit
						ad42685bf4
					
				
					 2 changed files with 29 additions and 10 deletions
				
			
		
							
								
								
									
										12
									
								
								ChangeLog
									
										
									
									
									
								
							
							
						
						
									
										12
									
								
								ChangeLog
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1,10 +1,20 @@
 | 
			
		|||
Wed Nov 27 17:25:29 2002  Akinori MUSHA  <knu@iDaemons.org>
 | 
			
		||||
 | 
			
		||||
	* ext/syslog/test.rb: Syslog.close should raise RuntimeError when
 | 
			
		||||
	  not opened.
 | 
			
		||||
 | 
			
		||||
	* ext/syslog/test.rb: Syslog.{ident,options,facility,mask} should
 | 
			
		||||
	  all return nil when not opened.
 | 
			
		||||
 | 
			
		||||
	* ext/syslog/test.rb: Change back the output format of inspect().
 | 
			
		||||
 | 
			
		||||
Wed Nov 27 16:25:43 2002  Akinori MUSHA  <knu@iDaemons.org>
 | 
			
		||||
 | 
			
		||||
	* ext/digest/test.rb: Switch from RUnit to Test::Unit.
 | 
			
		||||
 | 
			
		||||
Wed Nov 27 16:14:12 2002  Akinori MUSHA  <knu@iDaemons.org>
 | 
			
		||||
 | 
			
		||||
	* ext/syslog/syslog.c: Fix a problem where Syslog#ident was not
 | 
			
		||||
	* ext/syslog/syslog.c: Fix a problem where Syslog.ident was not
 | 
			
		||||
	  marked and could thus be GC'd.
 | 
			
		||||
 | 
			
		||||
Wed Nov 27 16:11:53 2002  Akinori MUSHA  <knu@iDaemons.org>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -28,7 +28,7 @@ class TestSyslog < Test::Unit::TestCase
 | 
			
		|||
    assert_equal(Syslog, sl2)
 | 
			
		||||
    assert_equal(Syslog, sl3)
 | 
			
		||||
  ensure
 | 
			
		||||
    Syslog.close
 | 
			
		||||
    Syslog.close if Syslog.opened?
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_open
 | 
			
		||||
| 
						 | 
				
			
			@ -59,16 +59,16 @@ class TestSyslog < Test::Unit::TestCase
 | 
			
		|||
    Syslog.open
 | 
			
		||||
    Syslog.close
 | 
			
		||||
 | 
			
		||||
    assert_equal($0, Syslog.ident)
 | 
			
		||||
    assert_equal(Syslog::LOG_PID | Syslog::LOG_CONS, Syslog.options)
 | 
			
		||||
    assert_equal(Syslog::LOG_USER, Syslog.facility)
 | 
			
		||||
    assert_equal(nil, Syslog.ident)
 | 
			
		||||
    assert_equal(nil, Syslog.options)
 | 
			
		||||
    assert_equal(nil, Syslog.facility)
 | 
			
		||||
 | 
			
		||||
    # block
 | 
			
		||||
    param = nil
 | 
			
		||||
    Syslog.open { |param| }
 | 
			
		||||
    assert_equal(Syslog, param)
 | 
			
		||||
  ensure
 | 
			
		||||
    Syslog.close
 | 
			
		||||
    Syslog.close if Syslog.opened?
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_opened?
 | 
			
		||||
| 
						 | 
				
			
			@ -87,7 +87,15 @@ class TestSyslog < Test::Unit::TestCase
 | 
			
		|||
    assert_equal(false, Syslog.opened?)
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_close
 | 
			
		||||
    assert_raises(RuntimeError) {
 | 
			
		||||
      Syslog.close
 | 
			
		||||
    }
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_mask
 | 
			
		||||
    assert_equal(nil, Syslog.mask)
 | 
			
		||||
 | 
			
		||||
    Syslog.open
 | 
			
		||||
 | 
			
		||||
    orig = Syslog.mask
 | 
			
		||||
| 
						 | 
				
			
			@ -100,7 +108,7 @@ class TestSyslog < Test::Unit::TestCase
 | 
			
		|||
 | 
			
		||||
    Syslog.mask = orig
 | 
			
		||||
  ensure
 | 
			
		||||
    Syslog.close
 | 
			
		||||
    Syslog.close if Syslog.opened?
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_log
 | 
			
		||||
| 
						 | 
				
			
			@ -142,14 +150,15 @@ class TestSyslog < Test::Unit::TestCase
 | 
			
		|||
 | 
			
		||||
  def test_inspect
 | 
			
		||||
    Syslog.open { |sl|
 | 
			
		||||
      assert_equal(format('<#%s: ident="%s", options=%d, facility=%d, mask=%d%s>',
 | 
			
		||||
      assert_equal(format('<#%s: opened=true, ident="%s", options=%d, facility=%d, mask=%d>',
 | 
			
		||||
			  Syslog,
 | 
			
		||||
			  sl.ident,
 | 
			
		||||
			  sl.options,
 | 
			
		||||
			  sl.facility,
 | 
			
		||||
			  sl.mask,
 | 
			
		||||
			  sl.opened? ? ', opened' : ''),
 | 
			
		||||
			  sl.mask),
 | 
			
		||||
		   sl.inspect)
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    assert_equal(format('<#%s: opened=false>', Syslog), Syslog.inspect)
 | 
			
		||||
  end
 | 
			
		||||
end
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue