summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-11-27 08:36:22 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2002-11-27 08:36:22 +0000
commitad42685bf4e2e5f1062c2f42b23a6c96566b56f8 (patch)
tree0e7a355ca21796b1490a8293b420c1b03bacbbd0
parentce0fd8c52311fef0a95ce9d3d72c756ca6f5b742 (diff)
* 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
-rw-r--r--ChangeLog12
-rw-r--r--ext/syslog/test.rb27
2 files changed, 29 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index b8411dc..fb77afe 100644
--- a/ChangeLog
+++ b/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>
diff --git a/ext/syslog/test.rb b/ext/syslog/test.rb
index ed5dd9d..cfa33ef 100644
--- a/ext/syslog/test.rb
+++ b/ext/syslog/test.rb
@@ -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