1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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:
nobu 2010-08-29 03:51:39 +00:00
parent 7e53b3b6ba
commit b9432e7630
3 changed files with 17 additions and 0 deletions

View file

@ -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
View file

@ -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);
}

View file

@ -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