summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-12 08:32:54 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-12 08:32:54 +0000
commit5f4778d3479f4af21000dd194485519e41835d29 (patch)
treef0681f5d371255a2ebaac9853283fc5a835096fa
parentecec55085597dd393a340664f93e61e9a8876044 (diff)
* lib/test/unit/assertions.rb (assert_throws, assert_nothing_thrown):
uncaught throw in sub thread raises ThreadError. * lib/test/unit/ui/tk/testrunner.rb (setup_ui): "expand" is not necessary. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog16
-rw-r--r--lib/test/unit/assertions.rb17
-rw-r--r--lib/test/unit/ui/tk/testrunner.rb2
3 files changed, 23 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 3ec34455ea..1bbac9c0f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Wed Nov 12 17:32:49 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * lib/test/unit/assertions.rb (assert_throws, assert_nothing_thrown):
+ uncaught throw in sub thread raises ThreadError.
+
+ * lib/test/unit/ui/tk/testrunner.rb (setup_ui): "expand" is not
+ necessary.
+
Wed Nov 12 14:09:43 2003 Shugo Maeda <shugo@ruby-lang.org>
* test/monitor/test_monitor.rb: fix the timing problem by Queue.
@@ -12,15 +20,15 @@ Wed Nov 12 10:14:28 2003 Shugo Maeda <shugo@ruby-lang.org>
Wed Nov 12 06:11:39 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
- * ext/openssl/ossl.c (ossl_x509_sk2ary, ossl_x509crl_sk2ary):
+ * ext/openssl/ossl.c (ossl_x509_sk2ary, ossl_x509crl_sk2ary):
add functions to convert STACK into Array.
* ext/openssl/ossl.h: add prototypes.
- * ext/openssl/ossl_pkcs7.c (ossl_pkcs7_set_certificates,
+ * ext/openssl/ossl_pkcs7.c (ossl_pkcs7_set_certificates,
ossl_pkcs7_get_certificates, ossl_pkcs7_get_crls,
ossl_pkcs7_set_crls): add functions for PKCS7#certificates=
- PKCS7#certificates, PKCS7#crls= and PKCS7#crls.
+ PKCS7#certificates, PKCS7#crls= and PKCS7#crls.
Tue Nov 12 00:47:00 2003 Nathaniel Talbott <ntalbott@ruby-lang.org>
@@ -52,7 +60,7 @@ Tue Nov 11 03:30:43 2003 GOTOU Yuuzou <gotoyuzo@notwork.org>
Mon Nov 10 11:40:29 2003 Shugo Maeda <shugo@ruby-lang.org>
* lib/monitor.rb (wait): return true on signal/broadcastfalse and
- false on timeout. Thanks Gennady Bystritsky.
+ false on timeout. Thanks Gennady Bystritsky.
Mon Nov 10 00:07:10 2003 Nobuyoshi Nakada <nobu@ruby-lang.org>
diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb
index c9ee8c101a..42f7379526 100644
--- a/lib/test/unit/assertions.rb
+++ b/lib/test/unit/assertions.rb
@@ -235,6 +235,9 @@ EOT
end
end
+ UncaughtThrow = {NameError => /^uncaught throw \`(.+)\'$/,
+ ThreadError => /^uncaught throw \`(.+)\' in thread /}
+
# Passes if block throws symbol.
public
def assert_throws(expected_symbol, message="", &proc)
@@ -249,13 +252,13 @@ EOT
end
full_message = build_message(message, "<?> should have been thrown.", expected_symbol)
assert_block(full_message){caught}
- rescue NameError => name_error
- if ( name_error.message !~ /^uncaught throw `(.+)'$/ ) #`
- raise name_error
+ rescue NameError, ThreadError => error
+ if UncaughtThrow[error.class] !~ error.message
+ raise error
end
full_message = build_message(message, "<?> expected to be thrown but\n<?> was thrown.", expected_symbol, $1.intern)
flunk(full_message)
- end
+ end
end
end
@@ -266,9 +269,9 @@ EOT
assert(block_given?, "Should have passed a block to assert_nothing_thrown")
begin
proc.call
- rescue NameError => name_error
- if (name_error.message !~ /^uncaught throw `(.+)'$/ ) #`
- raise name_error
+ rescue NameError, ThreadError => error
+ if UncaughtThrow[error.class] !~ error.message
+ raise error
end
full_message = build_message(message, "<?> was thrown when nothing was expected", $1.intern)
flunk(full_message)
diff --git a/lib/test/unit/ui/tk/testrunner.rb b/lib/test/unit/ui/tk/testrunner.rb
index adf5a10222..b37b79fd80 100644
--- a/lib/test/unit/ui/tk/testrunner.rb
+++ b/lib/test/unit/ui/tk/testrunner.rb
@@ -172,7 +172,7 @@ module Test
f = TkFrame.new(nil, 'relief'=>'sunken', 'borderwidth'=>3, 'height'=>20).pack('fill'=>'x', 'padx'=>1)
@test_progress_bar = TkFrame.new(f, 'background'=>'green').place('anchor'=>'nw', 'relwidth'=>0.0, 'relheight'=>1.0)
- info_frame = TkFrame.new.pack('fill'=>'x', 'expand'=>true)
+ info_frame = TkFrame.new.pack('fill'=>'x')
@test_count_label = create_count_label(info_frame, 'Tests:')
@assertion_count_label = create_count_label(info_frame, 'Assertions:')
@failure_count_label = create_count_label(info_frame, 'Failures:')