$LOAD_PATH.resolve_feature_path
should not raise
I think it's more friendly and easier to work with to return `nil` when the feature is not found in the $LOAD_PATH.
This commit is contained in:
parent
37b90bcdc1
commit
02151dad1b
Notes:
git
2021-02-16 18:11:52 +09:00
2
load.c
2
load.c
@ -991,7 +991,7 @@ rb_resolve_feature_path(VALUE klass, VALUE fname)
|
|||||||
sym = ID2SYM(rb_intern("so"));
|
sym = ID2SYM(rb_intern("so"));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
load_failed(fname);
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
return rb_ary_new_from_args(2, sym, path);
|
return rb_ary_new_from_args(2, sym, path);
|
||||||
|
@ -857,5 +857,9 @@ class TestRequire < Test::Unit::TestCase
|
|||||||
$:.replace(paths)
|
$:.replace(paths)
|
||||||
$".replace(loaded)
|
$".replace(loaded)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_resolve_feature_path_with_missing_feature
|
||||||
|
assert_nil($LOAD_PATH.resolve_feature_path("superkalifragilisticoespialidoso"))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user