summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-04-12 09:59:33 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>1999-04-12 09:59:33 +0000
commit83627b120c902e79bbb8994a0679712d31695878 (patch)
tree56603e4c5e15a49065ba5d3a8f915ca9d183eafb /sample
parent32e799db485107ba9d47fb4fb4cd44c9d6f57b8a (diff)
*** empty log message ***
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_3@416 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample')
-rw-r--r--sample/test.rb27
1 files changed, 19 insertions, 8 deletions
diff --git a/sample/test.rb b/sample/test.rb
index 5764144..11fa499 100644
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -599,14 +599,21 @@ ok(("abc" =~ /d*$/) == 3)
ok("" =~ /^$/)
ok("\n" =~ /^$/)
ok("a\n\n" =~ /^$/)
-"abcabc" =~ /.*a/
-ok($& == "abca")
-"abcabc" =~ /.*c/
-ok($& == "abcabc")
-"abcabc" =~ /.*?a/
-ok($& == "a")
-"abcabc" =~ /.*?c/
-ok($& == "abc")
+ok("abcabc" =~ /.*a/ && $& == "abca")
+ok("abcabc" =~ /.*c/ && $& == "abcabc")
+ok("abcabc" =~ /.*?a/ && $& == "a")
+ok("abcabc" =~ /.*?c/ && $& == "abc")
+ok(/(.|\n)*?\n(b|\n)/ =~ "a\nb\n\n" && $& == "a\nb")
+$x = <<END;
+ABCD
+ABCD
+END
+
+$x.gsub!(/((.|\n)*?)B((.|\n)*?)D/){$1+$3}
+ok($x == "AC\nAC\n")
+
+ok("foobar" =~ /foo(?=(bar)|(baz))/)
+ok("foobaz" =~ /foo(?=(bar)|(baz))/)
$foo = "abc"
ok("#$foo = abc" == "abc = abc")
@@ -845,9 +852,13 @@ ok($x[4].call == 8)
proc {
p = binding
eval "foo11 = 1", p
+ foo22 = 5
proc{foo11=22}.call
+ proc{foo22=55}.call
ok(eval("foo11", p) == eval("foo11"))
ok(eval("foo11") == 1)
+ ok(eval("foo22", p) == eval("foo22"))
+ ok(eval("foo22") == 55)
}.call
p1 = proc{i6 = 0; proc{i6}}.call