Backport #8662 » simple.patch
test/ruby/test_method.rb | ||
---|---|---|
assert_equal(File.dirname(File.realpath(__FILE__)), __dir__)
|
||
bug8436 = '[ruby-core:55123] [Bug #8436]'
|
||
assert_equal(__dir__, eval("__dir__", binding), bug8436)
|
||
assert_equal("arbitrary",
|
||
eval("__dir__", binding, File.join("arbitrary", "file.rb")),
|
||
bug8436)
|
||
end
|
||
def test_alias_owner
|
vm_eval.c | ||
---|---|---|
if (rb_obj_is_kind_of(scope, rb_cBinding)) {
|
||
GetBindingPtr(scope, bind);
|
||
envval = bind->env;
|
||
if (strcmp(file, "(eval)") == 0 && bind->path != Qnil) {
|
||
file = RSTRING_PTR(bind->path);
|
||
line = bind->first_lineno;
|
||
absolute_path = rb_current_realfilepath();
|
||
if (strcmp(file, "(eval)") == 0) {
|
||
if (bind->path != Qnil) {
|
||
file = RSTRING_PTR(bind->path);
|
||
line = bind->first_lineno;
|
||
absolute_path = rb_current_realfilepath();
|
||
}
|
||
}
|
||
else {
|
||
absolute_path = rb_str_new2(file);
|
||
}
|
||
}
|
||
else {
|
||
rb_raise(rb_eTypeError,
|