mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Added failing test to make btest
This commit is contained in:
parent
9d8cc01b75
commit
a8827e5c5f
1 changed files with 28 additions and 0 deletions
|
@ -43,6 +43,34 @@ assert_equal '6', %q{
|
||||||
retval = foo()
|
retval = foo()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# foo leaves a temp on the stack before the call
|
||||||
|
assert_equal '0', %q{
|
||||||
|
def bar(a, b)
|
||||||
|
return a - b
|
||||||
|
end
|
||||||
|
|
||||||
|
def foo
|
||||||
|
return 1 + bar(1, 2)
|
||||||
|
end
|
||||||
|
|
||||||
|
foo()
|
||||||
|
retval = foo()
|
||||||
|
}
|
||||||
|
|
||||||
|
# Recursive Ruby-to-Ruby calls
|
||||||
|
assert_equal '21', %q{
|
||||||
|
|
||||||
|
def fib(n)
|
||||||
|
if n < 2
|
||||||
|
return n
|
||||||
|
end
|
||||||
|
|
||||||
|
return fib(n-1) + fib(n-2)
|
||||||
|
end
|
||||||
|
|
||||||
|
r = fib(8)
|
||||||
|
}
|
||||||
|
|
||||||
# Ruby-to-Ruby call and C call
|
# Ruby-to-Ruby call and C call
|
||||||
assert_normal_exit %q{
|
assert_normal_exit %q{
|
||||||
def bar
|
def bar
|
||||||
|
|
Loading…
Add table
Reference in a new issue