1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2003-11-12 08:32:54 +00:00
parent ecec550855
commit 5f4778d347
3 changed files with 23 additions and 12 deletions

View file

@ -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>

View file

@ -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)

View file

@ -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:')