зеркало из https://github.com/github/ruby.git
* load.c (rb_provide_feature): clarify error message for frozen
$LOADED_FEATURES. based on a patch from Run Paint Run Run at [ruby-core:31913]. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29135 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
7e53b3b6ba
Коммит
b9432e7630
|
@ -1,3 +1,9 @@
|
|||
Sun Aug 29 12:51:33 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* load.c (rb_provide_feature): clarify error message for frozen
|
||||
$LOADED_FEATURES. based on a patch from Run Paint Run Run at
|
||||
[ruby-core:31913].
|
||||
|
||||
Sun Aug 29 12:19:58 2010 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* load.c (load_failed): should honor encoding. [ruby-core:31915]
|
||||
|
|
4
load.c
4
load.c
|
@ -250,6 +250,10 @@ rb_feature_provided(const char *feature, const char **loading)
|
|||
static void
|
||||
rb_provide_feature(VALUE feature)
|
||||
{
|
||||
if (OBJ_FROZEN(get_loaded_features())) {
|
||||
rb_raise(rb_eRuntimeError,
|
||||
"$LOADED_FEATURES is frozen; cannot append feature");
|
||||
}
|
||||
rb_ary_push(get_loaded_features(), feature);
|
||||
}
|
||||
|
||||
|
|
|
@ -310,4 +310,11 @@ class TestRequire < Test::Unit::TestCase
|
|||
}
|
||||
}
|
||||
end
|
||||
|
||||
def test_frozen_loaded_features
|
||||
bug3756 = '[ruby-core:31913]'
|
||||
assert_in_out_err(['-e', '$LOADED_FEATURES.freeze; require "ostruct"'], "",
|
||||
[], /\$LOADED_FEATURES is frozen; cannot append feature \(RuntimeError\)$/,
|
||||
bug3756)
|
||||
end
|
||||
end
|
||||
|
|
Загрузка…
Ссылка в новой задаче