mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Merge pull request #1692 from Paxa/Kernel_global_variables
Fix Kernel#global_variables for $1-$9
This commit is contained in:
+1
-1
@@ -1052,7 +1052,7 @@ mrb_f_global_variables(mrb_state *mrb, mrb_value self)
|
||||
buf[2] = 0;
|
||||
for (i = 1; i <= 9; ++i) {
|
||||
buf[1] = (char)(i + '0');
|
||||
mrb_ary_push(mrb, ary, mrb_symbol_value(mrb_intern_lit(mrb, buf)));
|
||||
mrb_ary_push(mrb, ary, mrb_symbol_value(mrb_intern(mrb, buf, 2)));
|
||||
}
|
||||
return ary;
|
||||
}
|
||||
|
||||
+8
-1
@@ -479,7 +479,7 @@ assert('Kernel#!=') do
|
||||
assert_false (str2 != str1)
|
||||
end
|
||||
|
||||
# operator "!~" is defined in ISO Ruby 11.4.4.
|
||||
# operator "!~" is defined in ISO Ruby 11.4.4.
|
||||
assert('Kernel#!~') do
|
||||
x = "x"
|
||||
def x.=~(other)
|
||||
@@ -511,6 +511,13 @@ assert('Kernel#respond_to_missing?') do
|
||||
assert_false Test4RespondToMissing.new.respond_to?(:no_method)
|
||||
end
|
||||
|
||||
assert('Kernel#global_variables') do
|
||||
variables = global_variables
|
||||
1.upto(9) do |i|
|
||||
assert_equal variables.include?(:"$#{i}"), true
|
||||
end
|
||||
end
|
||||
|
||||
assert('stack extend') do
|
||||
def recurse(count, stop)
|
||||
return count if count > stop
|
||||
|
||||
Reference in New Issue
Block a user