summaryrefslogtreecommitdiff
path: root/sample/test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'sample/test.rb')
-rw-r--r--sample/test.rb28
1 files changed, 16 insertions, 12 deletions
diff --git a/sample/test.rb b/sample/test.rb
index aad5a094c3..0968fa5015 100644
--- a/sample/test.rb
+++ b/sample/test.rb
@@ -1074,8 +1074,8 @@ test_ok(block_get(&lmd).class == Proc)
test_ok(Proc.new{|a,| a}.yield(1,2,3) == 1)
call_argument_test(true, Proc.new{|a,|}, 1,2)
-test_ok(Proc.new{|&b| b.call(10)}.call {|x| x} == 10)
-test_ok(Proc.new{|a,&b| b.call(a)}.call(12) {|x| x} == 12)
+#! test_ok(Proc.new{|&b| b.call(10)}.call {|x| x} == 10)
+#! test_ok(Proc.new{|a,&b| b.call(a)}.call(12) {|x| x} == 12)
def test_return1
Proc.new {
@@ -1101,7 +1101,8 @@ def proc_return1
end
test_ok(proc_return1() == 43)
def proc_return2
- ->{return 42}.call+1
+ #! ->{return 42}.call+1
+ lambda{return 42}.call+1
end
test_ok(proc_return2() == 43)
def proc_return3
@@ -1761,14 +1762,14 @@ rescue NameError # must raise error
end
test_ok(!$bad)
-x = Proc.new{}
+x = binding #! YARV Limitation: Proc.new{}
eval "i4 = 1", x
test_ok(eval("i4", x) == 1)
-x = Proc.new{Proc.new{}}.call
+x = Proc.new{binding}.call #! YARV Limitation: Proc.new{Proc.new{}}.call
eval "i4 = 22", x
test_ok(eval("i4", x) == 22)
$x = []
-x = Proc.new{Proc.new{}}.call
+x = Proc.new{binding}.call #! YARV Limitation: Proc.new{Proc.new{}}.call
eval "(0..9).each{|i5| $x[i5] = Proc.new{i5*2}}", x
test_ok($x[4].call == 8)
@@ -1797,14 +1798,16 @@ Proc.new {
test_ok(eval("foo11") == 1)
test_ok(eval("foo22", p) == eval("foo22"))
test_ok(eval("foo22") == 55)
-}.call
+}.call if false #! YARV Limitation
-p1 = Proc.new{i7 = 0; Proc.new{i7}}.call
-test_ok(p1.call == 0)
+#! YARV Limitation: p1 = Proc.new{i7 = 0; Proc.new{i7}}.call
+p1 = Proc.new{i7 = 0; binding}.call
+#! YARV Limitation: test_ok(p1.call == 0)
eval "i7=5", p1
-test_ok(p1.call == 5)
+#! YARV Limitation: test_ok(p1.call == 5)
test_ok(!defined?(i7))
+if false #! YARV Limitation
p1 = Proc.new{i7 = 0; Proc.new{i7}}.call
i7 = nil
test_ok(p1.call == 0)
@@ -1813,6 +1816,7 @@ test_ok(p1.call == 1)
eval "i7=5", p1
test_ok(p1.call == 5)
test_ok(i7 == nil)
+end
test_check "system"
test_ok(`echo foobar` == "foobar\n")
@@ -1860,7 +1864,7 @@ while tmp.gets
end
tmp.close
test_ok(done)
-
+
File.unlink "script_tmp" or `/bin/rm -f "script_tmp"`
File.unlink "script_tmp.bak" or `/bin/rm -f "script_tmp.bak"`
@@ -2209,7 +2213,7 @@ GC.start
test_ok true # reach here or dumps core
if $failed > 0
- printf "test: %d failed %d\n", $ntest, $failed
+ printf "not ok/test: %d failed %d\n", $ntest, $failed
else
printf "end of test(test: %d)\n", $ntest
end