From 3196645aee3add70a33f3d926d1d6e3820d39377 Mon Sep 17 00:00:00 2001 From: matz Date: Fri, 15 Oct 1999 08:52:18 +0000 Subject: -r debug, -s, etc. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@544 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- sample/test.rb | 29 +++++++++++++++++++++++++---- 1 file changed, 25 insertions(+), 4 deletions(-) (limited to 'sample') diff --git a/sample/test.rb b/sample/test.rb index a849a42fc2..e23c39f5e7 100644 --- a/sample/test.rb +++ b/sample/test.rb @@ -413,6 +413,23 @@ end tt{|i| break if i == 5} ok(i == 5) +def tt2(dummy) + yield 1 +end + +def tt3(&block) + tt2(raise(ArgumentError,""),&block) +end + +$x = false +begin + tt3{} +rescue ArgumentError + $x = true +rescue Exception +end +ok($x) + # iterator break/redo/next/retry done = true loop{ @@ -592,6 +609,10 @@ check "string & char" ok("abcd" == "abcd") ok("abcd" =~ "abcd") ok("abcd" === "abcd") +# compile time string concatenation +ok("ab" "cd" == "abcd") +ok("#{22}aa" "cd#{44}" == "22aacd44") +ok("#{22}aa" "cd#{44}" "55" "#{66}" == "22aacd445566") ok("abc" !~ /^$/) ok("abc\n" !~ /^$/) ok("abc" !~ /^d*$/) @@ -604,10 +625,6 @@ ok("abcabc" =~ /.*c/ && $& == "abcabc") ok("abcabc" =~ /.*?a/ && $& == "a") ok("abcabc" =~ /.*?c/ && $& == "abc") ok(/(.|\n)*?\n(b|\n)/ =~ "a\nb\n\n" && $& == "a\nb") -$x = <