Do not include a backtick in error messages and backtraces
[Feature #16495]
This commit is contained in:
parent
926277bf82
commit
25d74b9527
12
bignum.c
12
bignum.c
@ -4975,7 +4975,7 @@ big2str_generic(VALUE x, int base)
|
|||||||
invalid_radix(base);
|
invalid_radix(base);
|
||||||
|
|
||||||
if (xn >= LONG_MAX/BITSPERDIG) {
|
if (xn >= LONG_MAX/BITSPERDIG) {
|
||||||
rb_raise(rb_eRangeError, "bignum too big to convert into `string'");
|
rb_raise(rb_eRangeError, "bignum too big to convert into 'string'");
|
||||||
}
|
}
|
||||||
|
|
||||||
power_level = 0;
|
power_level = 0;
|
||||||
@ -5100,7 +5100,7 @@ rb_big2str1(VALUE x, int base)
|
|||||||
invalid_radix(base);
|
invalid_radix(base);
|
||||||
|
|
||||||
if (xn >= LONG_MAX/BITSPERDIG) {
|
if (xn >= LONG_MAX/BITSPERDIG) {
|
||||||
rb_raise(rb_eRangeError, "bignum too big to convert into `string'");
|
rb_raise(rb_eRangeError, "bignum too big to convert into 'string'");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (POW2_P(base)) {
|
if (POW2_P(base)) {
|
||||||
@ -5136,7 +5136,7 @@ big2ulong(VALUE x, const char *type)
|
|||||||
if (len == 0)
|
if (len == 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (BIGSIZE(x) > sizeof(long)) {
|
if (BIGSIZE(x) > sizeof(long)) {
|
||||||
rb_raise(rb_eRangeError, "bignum too big to convert into `%s'", type);
|
rb_raise(rb_eRangeError, "bignum too big to convert into '%s'", type);
|
||||||
}
|
}
|
||||||
ds = BDIGITS(x);
|
ds = BDIGITS(x);
|
||||||
#if SIZEOF_LONG <= SIZEOF_BDIGIT
|
#if SIZEOF_LONG <= SIZEOF_BDIGIT
|
||||||
@ -5179,7 +5179,7 @@ rb_big2long(VALUE x)
|
|||||||
if (num <= 1+(unsigned long)(-(LONG_MIN+1)))
|
if (num <= 1+(unsigned long)(-(LONG_MIN+1)))
|
||||||
return -(long)(num-1)-1;
|
return -(long)(num-1)-1;
|
||||||
}
|
}
|
||||||
rb_raise(rb_eRangeError, "bignum too big to convert into `long'");
|
rb_raise(rb_eRangeError, "bignum too big to convert into 'long'");
|
||||||
}
|
}
|
||||||
|
|
||||||
#if HAVE_LONG_LONG
|
#if HAVE_LONG_LONG
|
||||||
@ -5197,7 +5197,7 @@ big2ull(VALUE x, const char *type)
|
|||||||
if (len == 0)
|
if (len == 0)
|
||||||
return 0;
|
return 0;
|
||||||
if (BIGSIZE(x) > SIZEOF_LONG_LONG)
|
if (BIGSIZE(x) > SIZEOF_LONG_LONG)
|
||||||
rb_raise(rb_eRangeError, "bignum too big to convert into `%s'", type);
|
rb_raise(rb_eRangeError, "bignum too big to convert into '%s'", type);
|
||||||
#if SIZEOF_LONG_LONG <= SIZEOF_BDIGIT
|
#if SIZEOF_LONG_LONG <= SIZEOF_BDIGIT
|
||||||
num = (unsigned LONG_LONG)ds[0];
|
num = (unsigned LONG_LONG)ds[0];
|
||||||
#else
|
#else
|
||||||
@ -5238,7 +5238,7 @@ rb_big2ll(VALUE x)
|
|||||||
if (num <= 1+(unsigned LONG_LONG)(-(LLONG_MIN+1)))
|
if (num <= 1+(unsigned LONG_LONG)(-(LLONG_MIN+1)))
|
||||||
return -(LONG_LONG)(num-1)-1;
|
return -(LONG_LONG)(num-1)-1;
|
||||||
}
|
}
|
||||||
rb_raise(rb_eRangeError, "bignum too big to convert into `long long'");
|
rb_raise(rb_eRangeError, "bignum too big to convert into 'long long'");
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_LONG_LONG */
|
#endif /* HAVE_LONG_LONG */
|
||||||
|
@ -370,7 +370,7 @@ assert_equal %q{}, %q{
|
|||||||
}
|
}
|
||||||
|
|
||||||
##
|
##
|
||||||
assert_match /undefined method `foo\'/, %q{#`
|
assert_match /undefined method 'foo\'/, %q{#`
|
||||||
STDERR.reopen(STDOUT)
|
STDERR.reopen(STDOUT)
|
||||||
class C
|
class C
|
||||||
def inspect
|
def inspect
|
||||||
|
@ -534,9 +534,9 @@ end
|
|||||||
assert_syntax_error "unterminated string meets end of file", '().."', '[ruby-dev:29732]'
|
assert_syntax_error "unterminated string meets end of file", '().."', '[ruby-dev:29732]'
|
||||||
assert_equal %q{[]}, %q{$&;[]}, '[ruby-dev:31068]'
|
assert_equal %q{[]}, %q{$&;[]}, '[ruby-dev:31068]'
|
||||||
assert_syntax_error "unexpected *, expecting '}'", %q{{*0}}, '[ruby-dev:31072]'
|
assert_syntax_error "unexpected *, expecting '}'", %q{{*0}}, '[ruby-dev:31072]'
|
||||||
assert_syntax_error "`@0' is not allowed as an instance variable name", %q{@0..0}, '[ruby-dev:31095]'
|
assert_syntax_error "'@0' is not allowed as an instance variable name", %q{@0..0}, '[ruby-dev:31095]'
|
||||||
assert_syntax_error "`$00' is not allowed as a global variable name", %q{$00..0}, '[ruby-dev:31100]'
|
assert_syntax_error "'$00' is not allowed as a global variable name", %q{$00..0}, '[ruby-dev:31100]'
|
||||||
assert_syntax_error "`$00' is not allowed as a global variable name", %q{0..$00=1}
|
assert_syntax_error "'$00' is not allowed as a global variable name", %q{0..$00=1}
|
||||||
assert_equal %q{0}, %q{[*0];0}, '[ruby-dev:31102]'
|
assert_equal %q{0}, %q{[*0];0}, '[ruby-dev:31102]'
|
||||||
assert_syntax_error "unexpected ')'", %q{v0,(*,v1,) = 0}, '[ruby-dev:31104]'
|
assert_syntax_error "unexpected ')'", %q{v0,(*,v1,) = 0}, '[ruby-dev:31104]'
|
||||||
assert_equal %q{1}, %q{
|
assert_equal %q{1}, %q{
|
||||||
|
6
class.c
6
class.c
@ -990,7 +990,7 @@ rb_define_class(const char *name, VALUE super)
|
|||||||
return klass;
|
return klass;
|
||||||
}
|
}
|
||||||
if (!super) {
|
if (!super) {
|
||||||
rb_raise(rb_eArgError, "no super class for `%s'", name);
|
rb_raise(rb_eArgError, "no super class for '%s'", name);
|
||||||
}
|
}
|
||||||
klass = rb_define_class_id(id, super);
|
klass = rb_define_class_id(id, super);
|
||||||
rb_vm_add_root_module(klass);
|
rb_vm_add_root_module(klass);
|
||||||
@ -1030,7 +1030,7 @@ rb_define_class_id_under(VALUE outer, ID id, VALUE super)
|
|||||||
return klass;
|
return klass;
|
||||||
}
|
}
|
||||||
if (!super) {
|
if (!super) {
|
||||||
rb_raise(rb_eArgError, "no super class for `%"PRIsVALUE"::%"PRIsVALUE"'",
|
rb_raise(rb_eArgError, "no super class for '%"PRIsVALUE"::%"PRIsVALUE"'",
|
||||||
rb_class_path(outer), rb_id2str(id));
|
rb_class_path(outer), rb_id2str(id));
|
||||||
}
|
}
|
||||||
klass = rb_define_class_id(id, super);
|
klass = rb_define_class_id(id, super);
|
||||||
@ -1706,7 +1706,7 @@ VALUE
|
|||||||
rb_class_attached_object(VALUE klass)
|
rb_class_attached_object(VALUE klass)
|
||||||
{
|
{
|
||||||
if (!FL_TEST(klass, FL_SINGLETON)) {
|
if (!FL_TEST(klass, FL_SINGLETON)) {
|
||||||
rb_raise(rb_eTypeError, "`%"PRIsVALUE"' is not a singleton class", klass);
|
rb_raise(rb_eTypeError, "'%"PRIsVALUE"' is not a singleton class", klass);
|
||||||
}
|
}
|
||||||
|
|
||||||
return RCLASS_ATTACHED_OBJECT(klass);
|
return RCLASS_ATTACHED_OBJECT(klass);
|
||||||
|
@ -1791,7 +1791,7 @@ access_outer_variables(const rb_iseq_t *iseq, int level, ID id, bool write)
|
|||||||
COMPILE_ERROR(iseq, ISEQ_LAST_LINE(iseq), "can not yield from isolated Proc");
|
COMPILE_ERROR(iseq, ISEQ_LAST_LINE(iseq), "can not yield from isolated Proc");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
COMPILE_ERROR(iseq, ISEQ_LAST_LINE(iseq), "can not access variable `%s' from isolated Proc", rb_id2name(id));
|
COMPILE_ERROR(iseq, ISEQ_LAST_LINE(iseq), "can not access variable '%s' from isolated Proc", rb_id2name(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
debug.c
2
debug.c
@ -215,7 +215,7 @@ ruby_env_debug_option(const char *str, int len, void *arg)
|
|||||||
--len; \
|
--len; \
|
||||||
} \
|
} \
|
||||||
if (len > 0) { \
|
if (len > 0) { \
|
||||||
fprintf(stderr, "ignored "name" option: `%.*s'\n", len, str); \
|
fprintf(stderr, "ignored "name" option: '%.*s'\n", len, str); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
#define SET_WHEN_UINT(name, vals, num, req) \
|
#define SET_WHEN_UINT(name, vals, num, req) \
|
||||||
|
6
eval.c
6
eval.c
@ -592,15 +592,15 @@ setup_exception(rb_execution_context_t *ec, int tag, volatile VALUE mesg, VALUE
|
|||||||
e = rb_obj_as_string(mesg);
|
e = rb_obj_as_string(mesg);
|
||||||
ec->errinfo = mesg;
|
ec->errinfo = mesg;
|
||||||
if (file && line) {
|
if (file && line) {
|
||||||
e = rb_sprintf("Exception `%"PRIsVALUE"' at %s:%d - %"PRIsVALUE"\n",
|
e = rb_sprintf("Exception '%"PRIsVALUE"' at %s:%d - %"PRIsVALUE"\n",
|
||||||
rb_obj_class(mesg), file, line, e);
|
rb_obj_class(mesg), file, line, e);
|
||||||
}
|
}
|
||||||
else if (file) {
|
else if (file) {
|
||||||
e = rb_sprintf("Exception `%"PRIsVALUE"' at %s - %"PRIsVALUE"\n",
|
e = rb_sprintf("Exception '%"PRIsVALUE"' at %s - %"PRIsVALUE"\n",
|
||||||
rb_obj_class(mesg), file, e);
|
rb_obj_class(mesg), file, e);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
e = rb_sprintf("Exception `%"PRIsVALUE"' - %"PRIsVALUE"\n",
|
e = rb_sprintf("Exception '%"PRIsVALUE"' - %"PRIsVALUE"\n",
|
||||||
rb_obj_class(mesg), e);
|
rb_obj_class(mesg), e);
|
||||||
}
|
}
|
||||||
warn_print_str(e);
|
warn_print_str(e);
|
||||||
|
@ -47,7 +47,7 @@ error_pos_str(void)
|
|||||||
return rb_sprintf("%"PRIsVALUE": ", sourcefile);
|
return rb_sprintf("%"PRIsVALUE": ", sourcefile);
|
||||||
}
|
}
|
||||||
else if ((caller_name = rb_frame_callee()) != 0) {
|
else if ((caller_name = rb_frame_callee()) != 0) {
|
||||||
return rb_sprintf("%"PRIsVALUE":%d:in `%"PRIsVALUE"': ",
|
return rb_sprintf("%"PRIsVALUE":%d:in '%"PRIsVALUE"': ",
|
||||||
sourcefile, sourceline,
|
sourcefile, sourceline,
|
||||||
rb_id2str(caller_name));
|
rb_id2str(caller_name));
|
||||||
}
|
}
|
||||||
@ -392,7 +392,7 @@ rb_ec_error_print(rb_execution_context_t *volatile ec, volatile VALUE errinfo)
|
|||||||
rb_ec_error_print_detailed(ec, errinfo, Qnil, Qundef);
|
rb_ec_error_print_detailed(ec, errinfo, Qnil, Qundef);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define undef_mesg_for(v, k) rb_fstring_lit("undefined"v" method `%1$s' for "k" `%2$s'")
|
#define undef_mesg_for(v, k) rb_fstring_lit("undefined"v" method '%1$s' for "k" '%2$s'")
|
||||||
#define undef_mesg(v) ( \
|
#define undef_mesg(v) ( \
|
||||||
is_mod ? \
|
is_mod ? \
|
||||||
undef_mesg_for(v, "module") : \
|
undef_mesg_for(v, "module") : \
|
||||||
@ -420,7 +420,7 @@ rb_print_undef_str(VALUE klass, VALUE name)
|
|||||||
rb_name_err_raise_str(undef_mesg(""), klass, name);
|
rb_name_err_raise_str(undef_mesg(""), klass, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define inaccessible_mesg_for(v, k) rb_fstring_lit("method `%1$s' for "k" `%2$s' is "v)
|
#define inaccessible_mesg_for(v, k) rb_fstring_lit("method '%1$s' for "k" '%2$s' is "v)
|
||||||
#define inaccessible_mesg(v) ( \
|
#define inaccessible_mesg(v) ( \
|
||||||
is_mod ? \
|
is_mod ? \
|
||||||
inaccessible_mesg_for(v, "module") : \
|
inaccessible_mesg_for(v, "module") : \
|
||||||
|
@ -6,7 +6,7 @@ bug_struct_get(VALUE obj, VALUE name)
|
|||||||
ID id = rb_check_id(&name);
|
ID id = rb_check_id(&name);
|
||||||
|
|
||||||
if (!id) {
|
if (!id) {
|
||||||
rb_name_error_str(name, "`%"PRIsVALUE"' is not a struct member", name);
|
rb_name_error_str(name, "'%"PRIsVALUE"' is not a struct member", name);
|
||||||
}
|
}
|
||||||
return rb_struct_getmember(obj, id);
|
return rb_struct_getmember(obj, id);
|
||||||
}
|
}
|
||||||
|
6
file.c
6
file.c
@ -3666,7 +3666,7 @@ rb_default_home_dir(VALUE result)
|
|||||||
* lookup by getuid() has a chance of succeeding.
|
* lookup by getuid() has a chance of succeeding.
|
||||||
*/
|
*/
|
||||||
if (NIL_P(login_name)) {
|
if (NIL_P(login_name)) {
|
||||||
rb_raise(rb_eArgError, "couldn't find login name -- expanding `~'");
|
rb_raise(rb_eArgError, "couldn't find login name -- expanding '~'");
|
||||||
}
|
}
|
||||||
# endif /* !defined(HAVE_GETPWUID_R) && !defined(HAVE_GETPWUID) */
|
# endif /* !defined(HAVE_GETPWUID_R) && !defined(HAVE_GETPWUID) */
|
||||||
|
|
||||||
@ -3674,7 +3674,7 @@ rb_default_home_dir(VALUE result)
|
|||||||
if (NIL_P(pw_dir)) {
|
if (NIL_P(pw_dir)) {
|
||||||
pw_dir = rb_getpwdiruid();
|
pw_dir = rb_getpwdiruid();
|
||||||
if (NIL_P(pw_dir)) {
|
if (NIL_P(pw_dir)) {
|
||||||
rb_raise(rb_eArgError, "couldn't find home for uid `%ld'", (long)getuid());
|
rb_raise(rb_eArgError, "couldn't find home for uid '%ld'", (long)getuid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3685,7 +3685,7 @@ rb_default_home_dir(VALUE result)
|
|||||||
}
|
}
|
||||||
#endif /* defined HAVE_PWD_H */
|
#endif /* defined HAVE_PWD_H */
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
rb_raise(rb_eArgError, "couldn't find HOME environment -- expanding `~'");
|
rb_raise(rb_eArgError, "couldn't find HOME environment -- expanding '~'");
|
||||||
}
|
}
|
||||||
return copy_home_path(result, dir);
|
return copy_home_path(result, dir);
|
||||||
}
|
}
|
||||||
|
2
io.c
2
io.c
@ -8612,7 +8612,7 @@ deprecated_str_setter(VALUE val, ID id, VALUE *var)
|
|||||||
{
|
{
|
||||||
rb_str_setter(val, id, &val);
|
rb_str_setter(val, id, &val);
|
||||||
if (!NIL_P(val)) {
|
if (!NIL_P(val)) {
|
||||||
rb_warn_deprecated("`%s'", NULL, rb_id2name(id));
|
rb_warn_deprecated("'%s'", NULL, rb_id2name(id));
|
||||||
}
|
}
|
||||||
*var = val;
|
*var = val;
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ class Delegator < BasicObject
|
|||||||
# method calls are being delegated to.
|
# method calls are being delegated to.
|
||||||
#
|
#
|
||||||
def __getobj__
|
def __getobj__
|
||||||
__raise__ ::NotImplementedError, "need to define `__getobj__'"
|
__raise__ ::NotImplementedError, "need to define '__getobj__'"
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
@ -194,7 +194,7 @@ class Delegator < BasicObject
|
|||||||
# to _obj_.
|
# to _obj_.
|
||||||
#
|
#
|
||||||
def __setobj__(obj)
|
def __setobj__(obj)
|
||||||
__raise__ ::NotImplementedError, "need to define `__setobj__'"
|
__raise__ ::NotImplementedError, "need to define '__setobj__'"
|
||||||
end
|
end
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -1651,7 +1651,7 @@ module FileUtils
|
|||||||
when "a"
|
when "a"
|
||||||
mask | 07777
|
mask | 07777
|
||||||
else
|
else
|
||||||
raise ArgumentError, "invalid `who' symbol in file mode: #{chr}"
|
raise ArgumentError, "invalid 'who' symbol in file mode: #{chr}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -1705,7 +1705,7 @@ module FileUtils
|
|||||||
copy_mask = user_mask(chr)
|
copy_mask = user_mask(chr)
|
||||||
(current_mode & copy_mask) / (copy_mask & 0111) * (user_mask & 0111)
|
(current_mode & copy_mask) / (copy_mask & 0111) * (user_mask & 0111)
|
||||||
else
|
else
|
||||||
raise ArgumentError, "invalid `perm' symbol in file mode: #{chr}"
|
raise ArgumentError, "invalid 'perm' symbol in file mode: #{chr}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -1235,7 +1235,7 @@ module IRB
|
|||||||
lines.map{ |l| l + "\n" }.join
|
lines.map{ |l| l + "\n" }.join
|
||||||
}
|
}
|
||||||
# The "<top (required)>" in "(irb)" may be the top level of IRB so imitate the main object.
|
# The "<top (required)>" in "(irb)" may be the top level of IRB so imitate the main object.
|
||||||
message = message.gsub(/\(irb\):(?<num>\d+):in `<(?<frame>top \(required\))>'/) { "(irb):#{$~[:num]}:in `<main>'" }
|
message = message.gsub(/\(irb\):(?<num>\d+):in (?<open_quote>[`'])<(?<frame>top \(required\))>'/) { "(irb):#{$~[:num]}:in #{$~[:open_quote]}<main>'" }
|
||||||
puts message
|
puts message
|
||||||
puts 'Maybe IRB bug!' if irb_bug
|
puts 'Maybe IRB bug!' if irb_bug
|
||||||
rescue Exception => handler_exc
|
rescue Exception => handler_exc
|
||||||
|
@ -849,7 +849,7 @@ class OptionParser
|
|||||||
def accept(t, pat = /.*/m, &block)
|
def accept(t, pat = /.*/m, &block)
|
||||||
if pat
|
if pat
|
||||||
pat.respond_to?(:match) or
|
pat.respond_to?(:match) or
|
||||||
raise TypeError, "has no `match'", ParseError.filter_backtrace(caller(2))
|
raise TypeError, "has no 'match'", ParseError.filter_backtrace(caller(2))
|
||||||
else
|
else
|
||||||
pat = t if t.respond_to?(:match)
|
pat = t if t.respond_to?(:match)
|
||||||
end
|
end
|
||||||
|
@ -376,7 +376,7 @@ class OpenStruct
|
|||||||
end
|
end
|
||||||
@table.delete(sym) do
|
@table.delete(sym) do
|
||||||
return yield if block
|
return yield if block
|
||||||
raise! NameError.new("no field `#{sym}' in #{self}", sym)
|
raise! NameError.new("no field '#{sym}' in #{self}", sym)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@ class PStore
|
|||||||
in_transaction
|
in_transaction
|
||||||
unless @table.key? key
|
unless @table.key? key
|
||||||
if default == PStore::Error
|
if default == PStore::Error
|
||||||
raise PStore::Error, format("undefined key `%s'", key)
|
raise PStore::Error, format("undefined key '%s'", key)
|
||||||
else
|
else
|
||||||
return default
|
return default
|
||||||
end
|
end
|
||||||
|
@ -62,7 +62,7 @@ class Reline::History < Array
|
|||||||
private def check_index(index)
|
private def check_index(index)
|
||||||
index += size if index < 0
|
index += size if index < 0
|
||||||
if index < -2147483648 or 2147483647 < index
|
if index < -2147483648 or 2147483647 < index
|
||||||
raise RangeError.new("integer #{index} too big to convert to `int'")
|
raise RangeError.new("integer #{index} too big to convert to 'int'")
|
||||||
end
|
end
|
||||||
# If history_size is negative, history size is unlimited.
|
# If history_size is negative, history size is unlimited.
|
||||||
if @config.history_size.positive?
|
if @config.history_size.positive?
|
||||||
|
@ -455,7 +455,7 @@ class Time
|
|||||||
#
|
#
|
||||||
def strptime(date, format, now=self.now)
|
def strptime(date, format, now=self.now)
|
||||||
d = Date._strptime(date, format)
|
d = Date._strptime(date, format)
|
||||||
raise ArgumentError, "invalid date or strptime format - `#{date}' `#{format}'" unless d
|
raise ArgumentError, "invalid date or strptime format - '#{date}' '#{format}'" unless d
|
||||||
if seconds = d[:seconds]
|
if seconds = d[:seconds]
|
||||||
if sec_fraction = d[:sec_fraction]
|
if sec_fraction = d[:sec_fraction]
|
||||||
usec = sec_fraction * 1000000
|
usec = sec_fraction * 1000000
|
||||||
|
@ -158,7 +158,7 @@ class Dir
|
|||||||
n ||= 0
|
n ||= 0
|
||||||
n += 1
|
n += 1
|
||||||
retry if !max_try or n < max_try
|
retry if !max_try or n < max_try
|
||||||
raise "cannot generate temporary name using `#{basename}' under `#{tmpdir}'"
|
raise "cannot generate temporary name using '#{basename}' under '#{tmpdir}'"
|
||||||
end
|
end
|
||||||
path
|
path
|
||||||
end
|
end
|
||||||
|
12
marshal.c
12
marshal.c
@ -617,11 +617,11 @@ w_obj_each(ID id, VALUE value, st_data_t a)
|
|||||||
|
|
||||||
if (to_be_skipped_id(id)) {
|
if (to_be_skipped_id(id)) {
|
||||||
if (id == s_encoding_short) {
|
if (id == s_encoding_short) {
|
||||||
rb_warn("instance variable `"name_s_encoding_short"' on class %"PRIsVALUE" is not dumped",
|
rb_warn("instance variable '"name_s_encoding_short"' on class %"PRIsVALUE" is not dumped",
|
||||||
CLASS_OF(arg->obj));
|
CLASS_OF(arg->obj));
|
||||||
}
|
}
|
||||||
if (id == s_ruby2_keywords_flag) {
|
if (id == s_ruby2_keywords_flag) {
|
||||||
rb_warn("instance variable `"name_s_ruby2_keywords_flag"' on class %"PRIsVALUE" is not dumped",
|
rb_warn("instance variable '"name_s_ruby2_keywords_flag"' on class %"PRIsVALUE" is not dumped",
|
||||||
CLASS_OF(arg->obj));
|
CLASS_OF(arg->obj));
|
||||||
}
|
}
|
||||||
return ST_CONTINUE;
|
return ST_CONTINUE;
|
||||||
@ -1796,7 +1796,7 @@ append_extmod(VALUE obj, VALUE extmod)
|
|||||||
#define prohibit_ivar(type, str) do { \
|
#define prohibit_ivar(type, str) do { \
|
||||||
if (!ivp || !*ivp) break; \
|
if (!ivp || !*ivp) break; \
|
||||||
rb_raise(rb_eTypeError, \
|
rb_raise(rb_eTypeError, \
|
||||||
"can't override instance variable of "type" `%"PRIsVALUE"'", \
|
"can't override instance variable of "type" '%"PRIsVALUE"'", \
|
||||||
(str)); \
|
(str)); \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
@ -2133,7 +2133,7 @@ r_object_for(struct load_arg *arg, bool partial, int *ivp, VALUE extmod, int typ
|
|||||||
st_data_t d;
|
st_data_t d;
|
||||||
|
|
||||||
if (!rb_obj_respond_to(klass, s_load, TRUE)) {
|
if (!rb_obj_respond_to(klass, s_load, TRUE)) {
|
||||||
rb_raise(rb_eTypeError, "class %"PRIsVALUE" needs to have method `_load'",
|
rb_raise(rb_eTypeError, "class %"PRIsVALUE" needs to have method '_load'",
|
||||||
name);
|
name);
|
||||||
}
|
}
|
||||||
data = r_string(arg);
|
data = r_string(arg);
|
||||||
@ -2169,7 +2169,7 @@ r_object_for(struct load_arg *arg, bool partial, int *ivp, VALUE extmod, int typ
|
|||||||
append_extmod(v, extmod);
|
append_extmod(v, extmod);
|
||||||
}
|
}
|
||||||
if (!rb_obj_respond_to(v, s_mload, TRUE)) {
|
if (!rb_obj_respond_to(v, s_mload, TRUE)) {
|
||||||
rb_raise(rb_eTypeError, "instance of %"PRIsVALUE" needs to have method `marshal_load'",
|
rb_raise(rb_eTypeError, "instance of %"PRIsVALUE" needs to have method 'marshal_load'",
|
||||||
name);
|
name);
|
||||||
}
|
}
|
||||||
v = r_entry(v, arg);
|
v = r_entry(v, arg);
|
||||||
@ -2215,7 +2215,7 @@ r_object_for(struct load_arg *arg, bool partial, int *ivp, VALUE extmod, int typ
|
|||||||
v = r_entry(v, arg);
|
v = r_entry(v, arg);
|
||||||
if (!rb_obj_respond_to(v, s_load_data, TRUE)) {
|
if (!rb_obj_respond_to(v, s_load_data, TRUE)) {
|
||||||
rb_raise(rb_eTypeError,
|
rb_raise(rb_eTypeError,
|
||||||
"class %"PRIsVALUE" needs to have instance method `_load_data'",
|
"class %"PRIsVALUE" needs to have instance method '_load_data'",
|
||||||
name);
|
name);
|
||||||
}
|
}
|
||||||
r = r_object0(arg, partial, 0, extmod);
|
r = r_object0(arg, partial, 0, extmod);
|
||||||
|
14
numeric.c
14
numeric.c
@ -3213,7 +3213,7 @@ rb_num2ulong(VALUE val)
|
|||||||
void
|
void
|
||||||
rb_out_of_int(SIGNED_VALUE num)
|
rb_out_of_int(SIGNED_VALUE num)
|
||||||
{
|
{
|
||||||
rb_raise(rb_eRangeError, "integer %"PRIdVALUE " too %s to convert to `int'",
|
rb_raise(rb_eRangeError, "integer %"PRIdVALUE " too %s to convert to 'int'",
|
||||||
num, num < 0 ? "small" : "big");
|
num, num < 0 ? "small" : "big");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3232,12 +3232,12 @@ check_uint(unsigned long num, int sign)
|
|||||||
if (sign) {
|
if (sign) {
|
||||||
/* minus */
|
/* minus */
|
||||||
if (num < (unsigned long)INT_MIN)
|
if (num < (unsigned long)INT_MIN)
|
||||||
rb_raise(rb_eRangeError, "integer %ld too small to convert to `unsigned int'", (long)num);
|
rb_raise(rb_eRangeError, "integer %ld too small to convert to 'unsigned int'", (long)num);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* plus */
|
/* plus */
|
||||||
if (UINT_MAX < num)
|
if (UINT_MAX < num)
|
||||||
rb_raise(rb_eRangeError, "integer %lu too big to convert to `unsigned int'", num);
|
rb_raise(rb_eRangeError, "integer %lu too big to convert to 'unsigned int'", num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3312,7 +3312,7 @@ NORETURN(static void rb_out_of_short(SIGNED_VALUE num));
|
|||||||
static void
|
static void
|
||||||
rb_out_of_short(SIGNED_VALUE num)
|
rb_out_of_short(SIGNED_VALUE num)
|
||||||
{
|
{
|
||||||
rb_raise(rb_eRangeError, "integer %"PRIdVALUE " too %s to convert to `short'",
|
rb_raise(rb_eRangeError, "integer %"PRIdVALUE " too %s to convert to 'short'",
|
||||||
num, num < 0 ? "small" : "big");
|
num, num < 0 ? "small" : "big");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3330,12 +3330,12 @@ check_ushort(unsigned long num, int sign)
|
|||||||
if (sign) {
|
if (sign) {
|
||||||
/* minus */
|
/* minus */
|
||||||
if (num < (unsigned long)SHRT_MIN)
|
if (num < (unsigned long)SHRT_MIN)
|
||||||
rb_raise(rb_eRangeError, "integer %ld too small to convert to `unsigned short'", (long)num);
|
rb_raise(rb_eRangeError, "integer %ld too small to convert to 'unsigned short'", (long)num);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
/* plus */
|
/* plus */
|
||||||
if (USHRT_MAX < num)
|
if (USHRT_MAX < num)
|
||||||
rb_raise(rb_eRangeError, "integer %lu too big to convert to `unsigned short'", num);
|
rb_raise(rb_eRangeError, "integer %lu too big to convert to 'unsigned short'", num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -4709,7 +4709,7 @@ rb_int_cmp(VALUE x, VALUE y)
|
|||||||
return rb_big_cmp(x, y);
|
return rb_big_cmp(x, y);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_raise(rb_eNotImpError, "need to define `<=>' in %s", rb_obj_classname(x));
|
rb_raise(rb_eNotImpError, "need to define '<=>' in %s", rb_obj_classname(x));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
object.c
6
object.c
@ -2247,10 +2247,10 @@ rb_class_get_superclass(VALUE klass)
|
|||||||
return RCLASS(klass)->super;
|
return RCLASS(klass)->super;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char bad_instance_name[] = "`%1$s' is not allowed as an instance variable name";
|
static const char bad_instance_name[] = "'%1$s' is not allowed as an instance variable name";
|
||||||
static const char bad_class_name[] = "`%1$s' is not allowed as a class variable name";
|
static const char bad_class_name[] = "'%1$s' is not allowed as a class variable name";
|
||||||
static const char bad_const_name[] = "wrong constant name %1$s";
|
static const char bad_const_name[] = "wrong constant name %1$s";
|
||||||
static const char bad_attr_name[] = "invalid attribute name `%1$s'";
|
static const char bad_attr_name[] = "invalid attribute name '%1$s'";
|
||||||
#define wrong_constant_name bad_const_name
|
#define wrong_constant_name bad_const_name
|
||||||
|
|
||||||
/*! \private */
|
/*! \private */
|
||||||
|
182
parse.y
182
parse.y
@ -2034,7 +2034,7 @@ clear_block_exit(struct parser_params *p, bool error)
|
|||||||
|
|
||||||
#define WARN_EOL(tok) \
|
#define WARN_EOL(tok) \
|
||||||
(looking_at_eol_p(p) ? \
|
(looking_at_eol_p(p) ? \
|
||||||
(void)rb_warning0("`" tok "' at the end of line without an expression") : \
|
(void)rb_warning0("'" tok "' at the end of line without an expression") : \
|
||||||
(void)0)
|
(void)0)
|
||||||
static int looking_at_eol_p(struct parser_params *p);
|
static int looking_at_eol_p(struct parser_params *p);
|
||||||
|
|
||||||
@ -2707,55 +2707,55 @@ rb_str_to_parser_string(rb_parser_t *p, VALUE str)
|
|||||||
}
|
}
|
||||||
|
|
||||||
%token <id>
|
%token <id>
|
||||||
keyword_class "`class'"
|
keyword_class "'class'"
|
||||||
keyword_module "`module'"
|
keyword_module "'module'"
|
||||||
keyword_def "`def'"
|
keyword_def "'def'"
|
||||||
keyword_undef "`undef'"
|
keyword_undef "'undef'"
|
||||||
keyword_begin "`begin'"
|
keyword_begin "'begin'"
|
||||||
keyword_rescue "`rescue'"
|
keyword_rescue "'rescue'"
|
||||||
keyword_ensure "`ensure'"
|
keyword_ensure "'ensure'"
|
||||||
keyword_end "`end'"
|
keyword_end "'end'"
|
||||||
keyword_if "`if'"
|
keyword_if "'if'"
|
||||||
keyword_unless "`unless'"
|
keyword_unless "'unless'"
|
||||||
keyword_then "`then'"
|
keyword_then "'then'"
|
||||||
keyword_elsif "`elsif'"
|
keyword_elsif "'elsif'"
|
||||||
keyword_else "`else'"
|
keyword_else "'else'"
|
||||||
keyword_case "`case'"
|
keyword_case "'case'"
|
||||||
keyword_when "`when'"
|
keyword_when "'when'"
|
||||||
keyword_while "`while'"
|
keyword_while "'while'"
|
||||||
keyword_until "`until'"
|
keyword_until "'until'"
|
||||||
keyword_for "`for'"
|
keyword_for "'for'"
|
||||||
keyword_break "`break'"
|
keyword_break "'break'"
|
||||||
keyword_next "`next'"
|
keyword_next "'next'"
|
||||||
keyword_redo "`redo'"
|
keyword_redo "'redo'"
|
||||||
keyword_retry "`retry'"
|
keyword_retry "'retry'"
|
||||||
keyword_in "`in'"
|
keyword_in "'in'"
|
||||||
keyword_do "`do'"
|
keyword_do "'do'"
|
||||||
keyword_do_cond "`do' for condition"
|
keyword_do_cond "'do' for condition"
|
||||||
keyword_do_block "`do' for block"
|
keyword_do_block "'do' for block"
|
||||||
keyword_do_LAMBDA "`do' for lambda"
|
keyword_do_LAMBDA "'do' for lambda"
|
||||||
keyword_return "`return'"
|
keyword_return "'return'"
|
||||||
keyword_yield "`yield'"
|
keyword_yield "'yield'"
|
||||||
keyword_super "`super'"
|
keyword_super "'super'"
|
||||||
keyword_self "`self'"
|
keyword_self "'self'"
|
||||||
keyword_nil "`nil'"
|
keyword_nil "'nil'"
|
||||||
keyword_true "`true'"
|
keyword_true "'true'"
|
||||||
keyword_false "`false'"
|
keyword_false "'false'"
|
||||||
keyword_and "`and'"
|
keyword_and "'and'"
|
||||||
keyword_or "`or'"
|
keyword_or "'or'"
|
||||||
keyword_not "`not'"
|
keyword_not "'not'"
|
||||||
modifier_if "`if' modifier"
|
modifier_if "'if' modifier"
|
||||||
modifier_unless "`unless' modifier"
|
modifier_unless "'unless' modifier"
|
||||||
modifier_while "`while' modifier"
|
modifier_while "'while' modifier"
|
||||||
modifier_until "`until' modifier"
|
modifier_until "'until' modifier"
|
||||||
modifier_rescue "`rescue' modifier"
|
modifier_rescue "'rescue' modifier"
|
||||||
keyword_alias "`alias'"
|
keyword_alias "'alias'"
|
||||||
keyword_defined "`defined?'"
|
keyword_defined "'defined?'"
|
||||||
keyword_BEGIN "`BEGIN'"
|
keyword_BEGIN "'BEGIN'"
|
||||||
keyword_END "`END'"
|
keyword_END "'END'"
|
||||||
keyword__LINE__ "`__LINE__'"
|
keyword__LINE__ "'__LINE__'"
|
||||||
keyword__FILE__ "`__FILE__'"
|
keyword__FILE__ "'__FILE__'"
|
||||||
keyword__ENCODING__ "`__ENCODING__'"
|
keyword__ENCODING__ "'__ENCODING__'"
|
||||||
|
|
||||||
%token <id> tIDENTIFIER "local variable or method"
|
%token <id> tIDENTIFIER "local variable or method"
|
||||||
%token <id> tFID "method"
|
%token <id> tFID "method"
|
||||||
@ -9915,10 +9915,10 @@ arg_ambiguous(struct parser_params *p, char c)
|
|||||||
{
|
{
|
||||||
#ifndef RIPPER
|
#ifndef RIPPER
|
||||||
if (c == '/') {
|
if (c == '/') {
|
||||||
rb_warning1("ambiguity between regexp and two divisions: wrap regexp in parentheses or add a space after `%c' operator", WARN_I(c));
|
rb_warning1("ambiguity between regexp and two divisions: wrap regexp in parentheses or add a space after '%c' operator", WARN_I(c));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_warning1("ambiguous first argument; put parentheses or a space even after `%c' operator", WARN_I(c));
|
rb_warning1("ambiguous first argument; put parentheses or a space even after '%c' operator", WARN_I(c));
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
dispatch1(arg_ambiguous, rb_usascii_str_new(&c, 1));
|
dispatch1(arg_ambiguous, rb_usascii_str_new(&c, 1));
|
||||||
@ -10094,7 +10094,7 @@ parser_set_frozen_string_literal(struct parser_params *p, const char *name, cons
|
|||||||
int b;
|
int b;
|
||||||
|
|
||||||
if (p->token_seen) {
|
if (p->token_seen) {
|
||||||
rb_warning1("`%s' is ignored after any tokens", WARN_S(name));
|
rb_warning1("'%s' is ignored after any tokens", WARN_S(name));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10110,7 +10110,7 @@ parser_set_shareable_constant_value(struct parser_params *p, const char *name, c
|
|||||||
for (const char *s = p->lex.pbeg, *e = p->lex.pcur; s < e; ++s) {
|
for (const char *s = p->lex.pbeg, *e = p->lex.pcur; s < e; ++s) {
|
||||||
if (*s == ' ' || *s == '\t') continue;
|
if (*s == ' ' || *s == '\t') continue;
|
||||||
if (*s == '#') break;
|
if (*s == '#') break;
|
||||||
rb_warning1("`%s' is ignored unless in comment-only line", WARN_S(name));
|
rb_warning1("'%s' is ignored unless in comment-only line", WARN_S(name));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -10388,7 +10388,7 @@ parser_prepare(struct parser_params *p)
|
|||||||
|
|
||||||
#ifndef RIPPER
|
#ifndef RIPPER
|
||||||
#define ambiguous_operator(tok, op, syn) ( \
|
#define ambiguous_operator(tok, op, syn) ( \
|
||||||
rb_warning0("`"op"' after local variable or literal is interpreted as binary operator"), \
|
rb_warning0("'"op"' after local variable or literal is interpreted as binary operator"), \
|
||||||
rb_warning0("even though it seems like "syn""))
|
rb_warning0("even though it seems like "syn""))
|
||||||
#else
|
#else
|
||||||
#define ambiguous_operator(tok, op, syn) \
|
#define ambiguous_operator(tok, op, syn) \
|
||||||
@ -10619,7 +10619,7 @@ parse_numeric(struct parser_params *p, int c)
|
|||||||
trailing_uc:
|
trailing_uc:
|
||||||
literal_flush(p, p->lex.pcur - 1);
|
literal_flush(p, p->lex.pcur - 1);
|
||||||
YYLTYPE loc = RUBY_INIT_YYLLOC();
|
YYLTYPE loc = RUBY_INIT_YYLLOC();
|
||||||
compile_error(p, "trailing `%c' in number", nondigit);
|
compile_error(p, "trailing '%c' in number", nondigit);
|
||||||
parser_show_error_line(p, &loc);
|
parser_show_error_line(p, &loc);
|
||||||
}
|
}
|
||||||
tokfix(p);
|
tokfix(p);
|
||||||
@ -10685,8 +10685,8 @@ parse_qmark(struct parser_params *p, int space_seen)
|
|||||||
if (n < 0) return -1;
|
if (n < 0) return -1;
|
||||||
ptr += n;
|
ptr += n;
|
||||||
} while (!lex_eol_ptr_p(p, ptr) && is_identchar(p, ptr, p->lex.pend, p->enc));
|
} while (!lex_eol_ptr_p(p, ptr) && is_identchar(p, ptr, p->lex.pend, p->enc));
|
||||||
rb_warn2("`?' just followed by `%.*s' is interpreted as" \
|
rb_warn2("'?' just followed by '%.*s' is interpreted as" \
|
||||||
" a conditional operator, put a space after `?'",
|
" a conditional operator, put a space after '?'",
|
||||||
WARN_I((int)(ptr - start)), WARN_S_L(start, (ptr - start)));
|
WARN_I((int)(ptr - start)), WARN_S_L(start, (ptr - start)));
|
||||||
}
|
}
|
||||||
goto ternary;
|
goto ternary;
|
||||||
@ -10849,7 +10849,7 @@ parse_numvar(struct parser_params *p)
|
|||||||
|
|
||||||
if (overflow || n > nth_ref_max) {
|
if (overflow || n > nth_ref_max) {
|
||||||
/* compile_error()? */
|
/* compile_error()? */
|
||||||
rb_warn1("`%s' is too big for a number variable, always nil", WARN_S(tok(p)));
|
rb_warn1("'%s' is too big for a number variable, always nil", WARN_S(tok(p)));
|
||||||
return 0; /* $0 is $PROGRAM_NAME, not NTH_REF */
|
return 0; /* $0 is $PROGRAM_NAME, not NTH_REF */
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -10945,11 +10945,11 @@ parse_gvar(struct parser_params *p, const enum lex_state_e last_state)
|
|||||||
if (!parser_is_identchar(p)) {
|
if (!parser_is_identchar(p)) {
|
||||||
YYLTYPE loc = RUBY_INIT_YYLLOC();
|
YYLTYPE loc = RUBY_INIT_YYLLOC();
|
||||||
if (c == -1 || ISSPACE(c)) {
|
if (c == -1 || ISSPACE(c)) {
|
||||||
compile_error(p, "`$' without identifiers is not allowed as a global variable name");
|
compile_error(p, "'$' without identifiers is not allowed as a global variable name");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pushback(p, c);
|
pushback(p, c);
|
||||||
compile_error(p, "`$%c' is not allowed as a global variable name", c);
|
compile_error(p, "'$%c' is not allowed as a global variable name", c);
|
||||||
}
|
}
|
||||||
parser_show_error_line(p, &loc);
|
parser_show_error_line(p, &loc);
|
||||||
set_yylval_noname();
|
set_yylval_noname();
|
||||||
@ -10966,7 +10966,7 @@ parse_gvar(struct parser_params *p, const enum lex_state_e last_state)
|
|||||||
tokenize_ident(p);
|
tokenize_ident(p);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
compile_error(p, "`%.*s' is not allowed as a global variable name", toklen(p), tok(p));
|
compile_error(p, "'%.*s' is not allowed as a global variable name", toklen(p), tok(p));
|
||||||
set_yylval_noname();
|
set_yylval_noname();
|
||||||
}
|
}
|
||||||
return tGVAR;
|
return tGVAR;
|
||||||
@ -11017,10 +11017,10 @@ parse_atmark(struct parser_params *p, const enum lex_state_e last_state)
|
|||||||
pushback(p, c);
|
pushback(p, c);
|
||||||
RUBY_SET_YYLLOC(loc);
|
RUBY_SET_YYLLOC(loc);
|
||||||
if (result == tIVAR) {
|
if (result == tIVAR) {
|
||||||
compile_error(p, "`@' without identifiers is not allowed as an instance variable name");
|
compile_error(p, "'@' without identifiers is not allowed as an instance variable name");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
compile_error(p, "`@@' without identifiers is not allowed as a class variable name");
|
compile_error(p, "'@@' without identifiers is not allowed as a class variable name");
|
||||||
}
|
}
|
||||||
parser_show_error_line(p, &loc);
|
parser_show_error_line(p, &loc);
|
||||||
set_yylval_noname();
|
set_yylval_noname();
|
||||||
@ -11031,10 +11031,10 @@ parse_atmark(struct parser_params *p, const enum lex_state_e last_state)
|
|||||||
pushback(p, c);
|
pushback(p, c);
|
||||||
RUBY_SET_YYLLOC(loc);
|
RUBY_SET_YYLLOC(loc);
|
||||||
if (result == tIVAR) {
|
if (result == tIVAR) {
|
||||||
compile_error(p, "`@%c' is not allowed as an instance variable name", c);
|
compile_error(p, "'@%c' is not allowed as an instance variable name", c);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
compile_error(p, "`@@%c' is not allowed as a class variable name", c);
|
compile_error(p, "'@@%c' is not allowed as a class variable name", c);
|
||||||
}
|
}
|
||||||
parser_show_error_line(p, &loc);
|
parser_show_error_line(p, &loc);
|
||||||
set_yylval_noname();
|
set_yylval_noname();
|
||||||
@ -11333,7 +11333,7 @@ parser_yylex(struct parser_params *p)
|
|||||||
}
|
}
|
||||||
pushback(p, c);
|
pushback(p, c);
|
||||||
if (IS_SPCARG(c)) {
|
if (IS_SPCARG(c)) {
|
||||||
rb_warning0("`**' interpreted as argument prefix");
|
rb_warning0("'**' interpreted as argument prefix");
|
||||||
c = tDSTAR;
|
c = tDSTAR;
|
||||||
}
|
}
|
||||||
else if (IS_BEG()) {
|
else if (IS_BEG()) {
|
||||||
@ -11351,7 +11351,7 @@ parser_yylex(struct parser_params *p)
|
|||||||
}
|
}
|
||||||
pushback(p, c);
|
pushback(p, c);
|
||||||
if (IS_SPCARG(c)) {
|
if (IS_SPCARG(c)) {
|
||||||
rb_warning0("`*' interpreted as argument prefix");
|
rb_warning0("'*' interpreted as argument prefix");
|
||||||
c = tSTAR;
|
c = tSTAR;
|
||||||
}
|
}
|
||||||
else if (IS_BEG()) {
|
else if (IS_BEG()) {
|
||||||
@ -11541,7 +11541,7 @@ parser_yylex(struct parser_params *p)
|
|||||||
(c = peekc_n(p, 1)) == -1 ||
|
(c = peekc_n(p, 1)) == -1 ||
|
||||||
!(c == '\'' || c == '"' ||
|
!(c == '\'' || c == '"' ||
|
||||||
is_identchar(p, (p->lex.pcur+1), p->lex.pend, p->enc))) {
|
is_identchar(p, (p->lex.pcur+1), p->lex.pend, p->enc))) {
|
||||||
rb_warning0("`&' interpreted as argument prefix");
|
rb_warning0("'&' interpreted as argument prefix");
|
||||||
}
|
}
|
||||||
c = tAMPER;
|
c = tAMPER;
|
||||||
}
|
}
|
||||||
@ -11892,7 +11892,7 @@ parser_yylex(struct parser_params *p)
|
|||||||
|
|
||||||
default:
|
default:
|
||||||
if (!parser_is_identchar(p)) {
|
if (!parser_is_identchar(p)) {
|
||||||
compile_error(p, "Invalid char `\\x%02X' in expression", c);
|
compile_error(p, "Invalid char '\\x%02X' in expression", c);
|
||||||
token_flush(p);
|
token_flush(p);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
@ -13584,7 +13584,7 @@ it_used_p(struct parser_params *p)
|
|||||||
{
|
{
|
||||||
NODE *it = p->lvtbl->it;
|
NODE *it = p->lvtbl->it;
|
||||||
if (it) {
|
if (it) {
|
||||||
compile_error(p, "`it` is already used in\n"
|
compile_error(p, "'it' is already used in\n"
|
||||||
"%s:%d: current block here",
|
"%s:%d: current block here",
|
||||||
p->ruby_sourcefile, nd_line(it));
|
p->ruby_sourcefile, nd_line(it));
|
||||||
parser_show_error_line(p, &it->nd_loc);
|
parser_show_error_line(p, &it->nd_loc);
|
||||||
@ -13854,7 +13854,7 @@ check_literal_when(struct parser_params *p, NODE *arg, const YYLTYPE *loc)
|
|||||||
else {
|
else {
|
||||||
VALUE line = rb_hash_lookup(p->case_labels, lit);
|
VALUE line = rb_hash_lookup(p->case_labels, lit);
|
||||||
if (!NIL_P(line)) {
|
if (!NIL_P(line)) {
|
||||||
rb_warning1("duplicated `when' clause with line %d is ignored",
|
rb_warning1("duplicated 'when' clause with line %d is ignored",
|
||||||
WARN_IVAL(line));
|
WARN_IVAL(line));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -15013,7 +15013,7 @@ assign_in_cond(struct parser_params *p, NODE *node)
|
|||||||
if (!get_nd_value(p, node)) return 1;
|
if (!get_nd_value(p, node)) return 1;
|
||||||
if (is_static_content(get_nd_value(p, node))) {
|
if (is_static_content(get_nd_value(p, node))) {
|
||||||
/* reports always */
|
/* reports always */
|
||||||
parser_warn(p, get_nd_value(p, node), "found `= literal' in conditional, should be ==");
|
parser_warn(p, get_nd_value(p, node), "found '= literal' in conditional, should be ==");
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@ -17060,31 +17060,30 @@ rb_yytnamerr(struct parser_params *p, char *yyres, const char *yystr)
|
|||||||
|
|
||||||
while (*++yyp) {
|
while (*++yyp) {
|
||||||
switch (*yyp) {
|
switch (*yyp) {
|
||||||
case '`':
|
case '\'':
|
||||||
if (!bquote) {
|
if (!bquote) {
|
||||||
bquote = count_char(yyp+1, '`') + 1;
|
bquote = count_char(yyp+1, '\'') + 1;
|
||||||
if (yyres) memcpy(&yyres[yyn], yyp, bquote);
|
if (yyres) memcpy(&yyres[yyn], yyp, bquote);
|
||||||
yyn += bquote;
|
yyn += bquote;
|
||||||
yyp += bquote - 1;
|
yyp += bquote - 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
goto default_char;
|
else {
|
||||||
|
if (bquote && count_char(yyp+1, '\'') + 1 == bquote) {
|
||||||
case '\'':
|
if (yyres) memcpy(yyres + yyn, yyp, bquote);
|
||||||
if (bquote && count_char(yyp+1, '\'') + 1 == bquote) {
|
yyn += bquote;
|
||||||
if (yyres) memcpy(yyres + yyn, yyp, bquote);
|
yyp += bquote - 1;
|
||||||
yyn += bquote;
|
bquote = 0;
|
||||||
yyp += bquote - 1;
|
break;
|
||||||
bquote = 0;
|
}
|
||||||
break;
|
if (yyp[1] && yyp[1] != '\'' && yyp[2] == '\'') {
|
||||||
|
if (yyres) memcpy(yyres + yyn, yyp, 3);
|
||||||
|
yyn += 3;
|
||||||
|
yyp += 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
goto do_not_strip_quotes;
|
||||||
}
|
}
|
||||||
if (yyp[1] && yyp[1] != '\'' && yyp[2] == '\'') {
|
|
||||||
if (yyres) memcpy(yyres + yyn, yyp, 3);
|
|
||||||
yyn += 3;
|
|
||||||
yyp += 2;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
goto do_not_strip_quotes;
|
|
||||||
|
|
||||||
case ',':
|
case ',':
|
||||||
goto do_not_strip_quotes;
|
goto do_not_strip_quotes;
|
||||||
@ -17093,7 +17092,6 @@ rb_yytnamerr(struct parser_params *p, char *yyres, const char *yystr)
|
|||||||
if (*++yyp != '\\')
|
if (*++yyp != '\\')
|
||||||
goto do_not_strip_quotes;
|
goto do_not_strip_quotes;
|
||||||
/* Fall through. */
|
/* Fall through. */
|
||||||
default_char:
|
|
||||||
default:
|
default:
|
||||||
if (yyres)
|
if (yyres)
|
||||||
yyres[yyn] = *yyp;
|
yyres[yyn] = *yyp;
|
||||||
|
10
proc.c
10
proc.c
@ -457,13 +457,13 @@ check_local_id(VALUE bindval, volatile VALUE *pname)
|
|||||||
|
|
||||||
if (lid) {
|
if (lid) {
|
||||||
if (!rb_is_local_id(lid)) {
|
if (!rb_is_local_id(lid)) {
|
||||||
rb_name_err_raise("wrong local variable name `%1$s' for %2$s",
|
rb_name_err_raise("wrong local variable name '%1$s' for %2$s",
|
||||||
bindval, ID2SYM(lid));
|
bindval, ID2SYM(lid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (!rb_is_local_name(name)) {
|
if (!rb_is_local_name(name)) {
|
||||||
rb_name_err_raise("wrong local variable name `%1$s' for %2$s",
|
rb_name_err_raise("wrong local variable name '%1$s' for %2$s",
|
||||||
bindval, name);
|
bindval, name);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -536,7 +536,7 @@ bind_local_variable_get(VALUE bindval, VALUE sym)
|
|||||||
|
|
||||||
sym = ID2SYM(lid);
|
sym = ID2SYM(lid);
|
||||||
undefined:
|
undefined:
|
||||||
rb_name_err_raise("local variable `%1$s' is not defined for %2$s",
|
rb_name_err_raise("local variable '%1$s' is not defined for %2$s",
|
||||||
bindval, sym);
|
bindval, sym);
|
||||||
UNREACHABLE_RETURN(Qundef);
|
UNREACHABLE_RETURN(Qundef);
|
||||||
}
|
}
|
||||||
@ -1936,7 +1936,7 @@ method_owner(VALUE obj)
|
|||||||
void
|
void
|
||||||
rb_method_name_error(VALUE klass, VALUE str)
|
rb_method_name_error(VALUE klass, VALUE str)
|
||||||
{
|
{
|
||||||
#define MSG(s) rb_fstring_lit("undefined method `%1$s' for"s" `%2$s'")
|
#define MSG(s) rb_fstring_lit("undefined method '%1$s' for"s" '%2$s'")
|
||||||
VALUE c = klass;
|
VALUE c = klass;
|
||||||
VALUE s = Qundef;
|
VALUE s = Qundef;
|
||||||
|
|
||||||
@ -2091,7 +2091,7 @@ rb_obj_singleton_method(VALUE obj, VALUE vid)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* undef: */
|
/* undef: */
|
||||||
rb_name_err_raise("undefined singleton method `%1$s' for `%2$s'",
|
rb_name_err_raise("undefined singleton method '%1$s' for '%2$s'",
|
||||||
obj, vid);
|
obj, vid);
|
||||||
UNREACHABLE_RETURN(Qundef);
|
UNREACHABLE_RETURN(Qundef);
|
||||||
}
|
}
|
||||||
|
2
range.c
2
range.c
@ -78,7 +78,7 @@ range_modify(VALUE range)
|
|||||||
rb_check_frozen(range);
|
rb_check_frozen(range);
|
||||||
/* Ranges are immutable, so that they should be initialized only once. */
|
/* Ranges are immutable, so that they should be initialized only once. */
|
||||||
if (RANGE_EXCL(range) != Qnil) {
|
if (RANGE_EXCL(range) != Qnil) {
|
||||||
rb_name_err_raise("`initialize' called twice", range, ID2SYM(idInitialize));
|
rb_name_err_raise("'initialize' called twice", range, ID2SYM(idInitialize));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
rjit.c
2
rjit.c
@ -147,7 +147,7 @@ rb_rjit_setup_options(const char *s, struct rb_rjit_options *rjit_opt)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_raise(rb_eRuntimeError,
|
rb_raise(rb_eRuntimeError,
|
||||||
"invalid RJIT option `%s' (--help will show valid RJIT options)", s);
|
"invalid RJIT option '%s' (--help will show valid RJIT options)", s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
16
ruby.c
16
ruby.c
@ -1029,7 +1029,7 @@ feature_option(const char *str, int len, void *arg, const unsigned int enable)
|
|||||||
#if AMBIGUOUS_FEATURE_NAMES
|
#if AMBIGUOUS_FEATURE_NAMES
|
||||||
if (matched == 1) goto found;
|
if (matched == 1) goto found;
|
||||||
if (matched > 1) {
|
if (matched > 1) {
|
||||||
VALUE mesg = rb_sprintf("ambiguous feature: `%.*s' (", len, str);
|
VALUE mesg = rb_sprintf("ambiguous feature: '%.*s' (", len, str);
|
||||||
#define ADD_FEATURE_NAME(bit) \
|
#define ADD_FEATURE_NAME(bit) \
|
||||||
if (FEATURE_BIT(bit) & set) { \
|
if (FEATURE_BIT(bit) & set) { \
|
||||||
rb_str_cat_cstr(mesg, #bit); \
|
rb_str_cat_cstr(mesg, #bit); \
|
||||||
@ -1043,7 +1043,7 @@ feature_option(const char *str, int len, void *arg, const unsigned int enable)
|
|||||||
#else
|
#else
|
||||||
(void)set;
|
(void)set;
|
||||||
#endif
|
#endif
|
||||||
rb_warn("unknown argument for --%s: `%.*s'",
|
rb_warn("unknown argument for --%s: '%.*s'",
|
||||||
enable ? "enable" : "disable", len, str);
|
enable ? "enable" : "disable", len, str);
|
||||||
rb_warn("features are [%.*s].", (int)strlen(list), list);
|
rb_warn("features are [%.*s].", (int)strlen(list), list);
|
||||||
return;
|
return;
|
||||||
@ -1082,7 +1082,7 @@ debug_option(const char *str, int len, void *arg)
|
|||||||
#ifdef RUBY_DEVEL
|
#ifdef RUBY_DEVEL
|
||||||
if (ruby_patchlevel < 0 && ruby_env_debug_option(str, len, 0)) return;
|
if (ruby_patchlevel < 0 && ruby_env_debug_option(str, len, 0)) return;
|
||||||
#endif
|
#endif
|
||||||
rb_warn("unknown argument for --debug: `%.*s'", len, str);
|
rb_warn("unknown argument for --debug: '%.*s'", len, str);
|
||||||
rb_warn("debug features are [%.*s].", (int)strlen(list), list);
|
rb_warn("debug features are [%.*s].", (int)strlen(list), list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1105,14 +1105,14 @@ dump_additional_option(const char *str, int len, unsigned int bits, const char *
|
|||||||
w = memtermspn(str, additional_opt_sep, len);
|
w = memtermspn(str, additional_opt_sep, len);
|
||||||
#define SET_ADDITIONAL(bit) if (NAME_MATCH_P(#bit, str, w)) { \
|
#define SET_ADDITIONAL(bit) if (NAME_MATCH_P(#bit, str, w)) { \
|
||||||
if (bits & DUMP_BIT(bit)) \
|
if (bits & DUMP_BIT(bit)) \
|
||||||
rb_warn("duplicate option to dump %s: `%.*s'", name, w, str); \
|
rb_warn("duplicate option to dump %s: '%.*s'", name, w, str); \
|
||||||
bits |= DUMP_BIT(bit); \
|
bits |= DUMP_BIT(bit); \
|
||||||
continue; \
|
continue; \
|
||||||
}
|
}
|
||||||
if (dump_error_tolerant_bits & bits) {
|
if (dump_error_tolerant_bits & bits) {
|
||||||
SET_ADDITIONAL(error_tolerant);
|
SET_ADDITIONAL(error_tolerant);
|
||||||
}
|
}
|
||||||
rb_warn("don't know how to dump %s with `%.*s'", name, w, str);
|
rb_warn("don't know how to dump %s with '%.*s'", name, w, str);
|
||||||
}
|
}
|
||||||
return bits;
|
return bits;
|
||||||
}
|
}
|
||||||
@ -1130,7 +1130,7 @@ dump_option(const char *str, int len, void *arg)
|
|||||||
return; \
|
return; \
|
||||||
}
|
}
|
||||||
EACH_DUMPS(SET_WHEN_DUMP, ;);
|
EACH_DUMPS(SET_WHEN_DUMP, ;);
|
||||||
rb_warn("don't know how to dump `%.*s',", len, str);
|
rb_warn("don't know how to dump '%.*s',", len, str);
|
||||||
rb_warn("but only [%.*s].", (int)strlen(list), list);
|
rb_warn("but only [%.*s].", (int)strlen(list), list);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1176,7 +1176,7 @@ setup_yjit_options(const char *s)
|
|||||||
|
|
||||||
rb_raise(
|
rb_raise(
|
||||||
rb_eRuntimeError,
|
rb_eRuntimeError,
|
||||||
"invalid YJIT option `%s' (--help will show valid yjit options)",
|
"invalid YJIT option '%s' (--help will show valid yjit options)",
|
||||||
s
|
s
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@ -1214,7 +1214,7 @@ proc_W_option(ruby_cmdline_options_t *opt, const char *s, int *warning)
|
|||||||
bits = 1U << RB_WARN_CATEGORY_PERFORMANCE;
|
bits = 1U << RB_WARN_CATEGORY_PERFORMANCE;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_warn("unknown warning category: `%s'", s);
|
rb_warn("unknown warning category: '%s'", s);
|
||||||
}
|
}
|
||||||
if (bits) FEATURE_SET_TO(opt->warn, bits, enable ? bits : 0);
|
if (bits) FEATURE_SET_TO(opt->warn, bits, enable ? bits : 0);
|
||||||
return 0;
|
return 0;
|
||||||
|
2
signal.c
2
signal.c
@ -274,7 +274,7 @@ signm2signo(VALUE *sig_ptr, int negative, int exit, int *prefix_ptr)
|
|||||||
vsig = rb_str_subseq(vsig, prefix, len);
|
vsig = rb_str_subseq(vsig, prefix, len);
|
||||||
prefix = signame_prefix_len;
|
prefix = signame_prefix_len;
|
||||||
}
|
}
|
||||||
rb_raise(rb_eArgError, "unsupported signal `%.*s%"PRIsVALUE"'",
|
rb_raise(rb_eArgError, "unsupported signal '%.*s%"PRIsVALUE"'",
|
||||||
prefix, signame_prefix, vsig);
|
prefix, signame_prefix, vsig);
|
||||||
UNREACHABLE_RETURN(0);
|
UNREACHABLE_RETURN(0);
|
||||||
}
|
}
|
||||||
|
2
string.c
2
string.c
@ -10939,7 +10939,7 @@ rb_fs_setter(VALUE val, ID id, VALUE *var)
|
|||||||
rb_id2str(id));
|
rb_id2str(id));
|
||||||
}
|
}
|
||||||
if (!NIL_P(val)) {
|
if (!NIL_P(val)) {
|
||||||
rb_warn_deprecated("`$;'", NULL);
|
rb_warn_deprecated("'$;'", NULL);
|
||||||
}
|
}
|
||||||
*var = val;
|
*var = val;
|
||||||
}
|
}
|
||||||
|
2
struct.c
2
struct.c
@ -236,7 +236,7 @@ rb_struct_getmember(VALUE obj, ID id)
|
|||||||
if (i != -1) {
|
if (i != -1) {
|
||||||
return RSTRUCT_GET(obj, i);
|
return RSTRUCT_GET(obj, i);
|
||||||
}
|
}
|
||||||
rb_name_err_raise("`%1$s' is not a struct member", obj, ID2SYM(id));
|
rb_name_err_raise("'%1$s' is not a struct member", obj, ID2SYM(id));
|
||||||
|
|
||||||
UNREACHABLE_RETURN(Qnil);
|
UNREACHABLE_RETURN(Qnil);
|
||||||
}
|
}
|
||||||
|
@ -11,7 +11,7 @@ module Bug::Marshal
|
|||||||
assert_equal("hello", v.normal)
|
assert_equal("hello", v.normal)
|
||||||
assert_equal("world", v.internal)
|
assert_equal("world", v.internal)
|
||||||
assert_equal("bye", v.encoding_short)
|
assert_equal("bye", v.encoding_short)
|
||||||
dump = assert_warn(/instance variable `E' on class \S+ is not dumped/) {
|
dump = assert_warn(/instance variable 'E' on class \S+ is not dumped/) {
|
||||||
::Marshal.dump(v)
|
::Marshal.dump(v)
|
||||||
}
|
}
|
||||||
v = assert_nothing_raised {break ::Marshal.load(dump)}
|
v = assert_nothing_raised {break ::Marshal.load(dump)}
|
||||||
|
@ -13,8 +13,8 @@ end
|
|||||||
SRC
|
SRC
|
||||||
out = [
|
out = [
|
||||||
"start() function is unimplemented on this machine",
|
"start() function is unimplemented on this machine",
|
||||||
"-:2:in `start'",
|
"-:2:in 'start'",
|
||||||
"-:2:in `<main>'",
|
"-:2:in '<main>'",
|
||||||
]
|
]
|
||||||
assert_in_out_err(%w"-r-test-/bug_3571", src, [], out, bug3571)
|
assert_in_out_err(%w"-r-test-/bug_3571", src, [], out, bug3571)
|
||||||
end
|
end
|
||||||
|
@ -49,7 +49,7 @@ class NameErrorExtensionTest < Test::Unit::TestCase
|
|||||||
|
|
||||||
get_message(error)
|
get_message(error)
|
||||||
|
|
||||||
assert_match(/^undefined method `sizee' for /,
|
assert_match(/^undefined method [`']sizee' for /,
|
||||||
Marshal.load(Marshal.dump(error)).original_message)
|
Marshal.load(Marshal.dump(error)).original_message)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -23,17 +23,31 @@ class ErrorHighlightTest < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
begin
|
||||||
|
method_not_exist
|
||||||
|
rescue NameError
|
||||||
|
if $!.message.include?("`")
|
||||||
|
def preprocess(msg)
|
||||||
|
msg
|
||||||
|
end
|
||||||
|
else
|
||||||
|
def preprocess(msg)
|
||||||
|
msg.sub("`", "'")
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
if Exception.method_defined?(:detailed_message)
|
if Exception.method_defined?(:detailed_message)
|
||||||
def assert_error_message(klass, expected_msg, &blk)
|
def assert_error_message(klass, expected_msg, &blk)
|
||||||
omit unless klass < ErrorHighlight::CoreExt
|
omit unless klass < ErrorHighlight::CoreExt
|
||||||
err = assert_raise(klass, &blk)
|
err = assert_raise(klass, &blk)
|
||||||
assert_equal(expected_msg.chomp, err.detailed_message(highlight: false).sub(/ \((?:NoMethod|Name)Error\)/, ""))
|
assert_equal(preprocess(expected_msg).chomp, err.detailed_message(highlight: false).sub(/ \((?:NoMethod|Name)Error\)/, ""))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
def assert_error_message(klass, expected_msg, &blk)
|
def assert_error_message(klass, expected_msg, &blk)
|
||||||
omit unless klass < ErrorHighlight::CoreExt
|
omit unless klass < ErrorHighlight::CoreExt
|
||||||
err = assert_raise(klass, &blk)
|
err = assert_raise(klass, &blk)
|
||||||
assert_equal(expected_msg.chomp, err.message)
|
assert_equal(preprocess(expected_msg).chomp, err.message)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ module TestIRB
|
|||||||
irb.eval_input
|
irb.eval_input
|
||||||
end
|
end
|
||||||
assert_empty err
|
assert_empty err
|
||||||
assert_pattern_list([:*, /\(irb\):1:in `<main>': Foo \(RuntimeError\)\n/,
|
assert_pattern_list([:*, /\(irb\):1:in '<main>': Foo \(RuntimeError\)\n/,
|
||||||
:*, /#<RuntimeError: Foo>\n/,
|
:*, /#<RuntimeError: Foo>\n/,
|
||||||
:*, /0$/,
|
:*, /0$/,
|
||||||
:*, /0$/,
|
:*, /0$/,
|
||||||
@ -89,8 +89,8 @@ module TestIRB
|
|||||||
end
|
end
|
||||||
assert_empty err
|
assert_empty err
|
||||||
assert_pattern_list([
|
assert_pattern_list([
|
||||||
:*, /\(irb\):1:in `<main>': Foo \(RuntimeError\)\n/,
|
:*, /\(irb\):1:in '<main>': Foo \(RuntimeError\)\n/,
|
||||||
:*, /\(irb\):2:in `<main>': Bar \(RuntimeError\)\n/,
|
:*, /\(irb\):2:in '<main>': Bar \(RuntimeError\)\n/,
|
||||||
:*, /#<RuntimeError: Bar>\n/,
|
:*, /#<RuntimeError: Bar>\n/,
|
||||||
], out)
|
], out)
|
||||||
end
|
end
|
||||||
@ -130,9 +130,9 @@ module TestIRB
|
|||||||
[:marshal, "123", Marshal.dump(123)],
|
[:marshal, "123", Marshal.dump(123)],
|
||||||
],
|
],
|
||||||
failed: [
|
failed: [
|
||||||
[false, "BasicObject.new", /#<NoMethodError: undefined method `to_s' for/],
|
[false, "BasicObject.new", /#<NoMethodError: undefined method 'to_s' for/],
|
||||||
[:p, "class Foo; undef inspect ;end; Foo.new", /#<NoMethodError: undefined method `inspect' for/],
|
[:p, "class Foo; undef inspect ;end; Foo.new", /#<NoMethodError: undefined method 'inspect' for/],
|
||||||
[:yaml, "BasicObject.new", /#<NoMethodError: undefined method `inspect' for/],
|
[:yaml, "BasicObject.new", /#<NoMethodError: undefined method 'inspect' for/],
|
||||||
[:marshal, "[Object.new, Class.new]", /#<TypeError: can't dump anonymous class #<Class:/]
|
[:marshal, "[Object.new, Class.new]", /#<TypeError: can't dump anonymous class #<Class:/]
|
||||||
]
|
]
|
||||||
}.each do |scenario, cases|
|
}.each do |scenario, cases|
|
||||||
@ -210,7 +210,7 @@ module TestIRB
|
|||||||
end
|
end
|
||||||
assert_empty err
|
assert_empty err
|
||||||
assert_match(/An error occurred when inspecting the object: #<RuntimeError: foo>/, out)
|
assert_match(/An error occurred when inspecting the object: #<RuntimeError: foo>/, out)
|
||||||
assert_match(/An error occurred when running Kernel#inspect: #<NoMethodError: undefined method `inspect' for/, out)
|
assert_match(/An error occurred when running Kernel#inspect: #<NoMethodError: undefined method 'inspect' for/, out)
|
||||||
ensure
|
ensure
|
||||||
$VERBOSE = verbose
|
$VERBOSE = verbose
|
||||||
end
|
end
|
||||||
@ -503,15 +503,15 @@ module TestIRB
|
|||||||
if RUBY_VERSION < '3.0.0' && STDOUT.tty?
|
if RUBY_VERSION < '3.0.0' && STDOUT.tty?
|
||||||
expected = [
|
expected = [
|
||||||
:*, /Traceback \(most recent call last\):\n/,
|
:*, /Traceback \(most recent call last\):\n/,
|
||||||
:*, /\t 2: from \(irb\):1:in `<main>'\n/,
|
:*, /\t 2: from \(irb\):1:in '<main>'\n/,
|
||||||
:*, /\t 1: from \(irb\):1:in `hoge'\n/,
|
:*, /\t 1: from \(irb\):1:in 'hoge'\n/,
|
||||||
:*, /\(irb\):1:in `fuga': unhandled exception\n/,
|
:*, /\(irb\):1:in 'fuga': unhandled exception\n/,
|
||||||
]
|
]
|
||||||
else
|
else
|
||||||
expected = [
|
expected = [
|
||||||
:*, /\(irb\):1:in `fuga': unhandled exception\n/,
|
:*, /\(irb\):1:in 'fuga': unhandled exception\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `hoge'\n/,
|
:*, /\tfrom \(irb\):1:in 'hoge'\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `<main>'\n/,
|
:*, /\tfrom \(irb\):1:in '<main>'\n/,
|
||||||
:*
|
:*
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
@ -533,15 +533,15 @@ module TestIRB
|
|||||||
if RUBY_VERSION < '3.0.0' && STDOUT.tty?
|
if RUBY_VERSION < '3.0.0' && STDOUT.tty?
|
||||||
expected = [
|
expected = [
|
||||||
:*, /Traceback \(most recent call last\):\n/,
|
:*, /Traceback \(most recent call last\):\n/,
|
||||||
:*, /\t 2: from \(irb\):1:in `<main>'\n/,
|
:*, /\t 2: from \(irb\):1:in '<main>'\n/,
|
||||||
:*, /\t 1: from \(irb\):1:in `hoge'\n/,
|
:*, /\t 1: from \(irb\):1:in 'hoge'\n/,
|
||||||
:*, /\(irb\):1:in `fuga': A\\xF3B \(RuntimeError\)\n/,
|
:*, /\(irb\):1:in 'fuga': A\\xF3B \(RuntimeError\)\n/,
|
||||||
]
|
]
|
||||||
else
|
else
|
||||||
expected = [
|
expected = [
|
||||||
:*, /\(irb\):1:in `fuga': A\\xF3B \(RuntimeError\)\n/,
|
:*, /\(irb\):1:in 'fuga': A\\xF3B \(RuntimeError\)\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `hoge'\n/,
|
:*, /\tfrom \(irb\):1:in 'hoge'\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `<main>'\n/,
|
:*, /\tfrom \(irb\):1:in '<main>'\n/,
|
||||||
:*
|
:*
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
@ -571,43 +571,43 @@ module TestIRB
|
|||||||
expected = [
|
expected = [
|
||||||
:*, /Traceback \(most recent call last\):\n/,
|
:*, /Traceback \(most recent call last\):\n/,
|
||||||
:*, /\t... \d+ levels...\n/,
|
:*, /\t... \d+ levels...\n/,
|
||||||
:*, /\t16: from \(irb\):1:in `a4'\n/,
|
:*, /\t16: from \(irb\):1:in 'a4'\n/,
|
||||||
:*, /\t15: from \(irb\):1:in `a5'\n/,
|
:*, /\t15: from \(irb\):1:in 'a5'\n/,
|
||||||
:*, /\t14: from \(irb\):1:in `a6'\n/,
|
:*, /\t14: from \(irb\):1:in 'a6'\n/,
|
||||||
:*, /\t13: from \(irb\):1:in `a7'\n/,
|
:*, /\t13: from \(irb\):1:in 'a7'\n/,
|
||||||
:*, /\t12: from \(irb\):1:in `a8'\n/,
|
:*, /\t12: from \(irb\):1:in 'a8'\n/,
|
||||||
:*, /\t11: from \(irb\):1:in `a9'\n/,
|
:*, /\t11: from \(irb\):1:in 'a9'\n/,
|
||||||
:*, /\t10: from \(irb\):1:in `a10'\n/,
|
:*, /\t10: from \(irb\):1:in 'a10'\n/,
|
||||||
:*, /\t 9: from \(irb\):1:in `a11'\n/,
|
:*, /\t 9: from \(irb\):1:in 'a11'\n/,
|
||||||
:*, /\t 8: from \(irb\):1:in `a12'\n/,
|
:*, /\t 8: from \(irb\):1:in 'a12'\n/,
|
||||||
:*, /\t 7: from \(irb\):1:in `a13'\n/,
|
:*, /\t 7: from \(irb\):1:in 'a13'\n/,
|
||||||
:*, /\t 6: from \(irb\):1:in `a14'\n/,
|
:*, /\t 6: from \(irb\):1:in 'a14'\n/,
|
||||||
:*, /\t 5: from \(irb\):1:in `a15'\n/,
|
:*, /\t 5: from \(irb\):1:in 'a15'\n/,
|
||||||
:*, /\t 4: from \(irb\):1:in `a16'\n/,
|
:*, /\t 4: from \(irb\):1:in 'a16'\n/,
|
||||||
:*, /\t 3: from \(irb\):1:in `a17'\n/,
|
:*, /\t 3: from \(irb\):1:in 'a17'\n/,
|
||||||
:*, /\t 2: from \(irb\):1:in `a18'\n/,
|
:*, /\t 2: from \(irb\):1:in 'a18'\n/,
|
||||||
:*, /\t 1: from \(irb\):1:in `a19'\n/,
|
:*, /\t 1: from \(irb\):1:in 'a19'\n/,
|
||||||
:*, /\(irb\):1:in `a20': unhandled exception\n/,
|
:*, /\(irb\):1:in 'a20': unhandled exception\n/,
|
||||||
]
|
]
|
||||||
else
|
else
|
||||||
expected = [
|
expected = [
|
||||||
:*, /\(irb\):1:in `a20': unhandled exception\n/,
|
:*, /\(irb\):1:in 'a20': unhandled exception\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `a19'\n/,
|
:*, /\tfrom \(irb\):1:in 'a19'\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `a18'\n/,
|
:*, /\tfrom \(irb\):1:in 'a18'\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `a17'\n/,
|
:*, /\tfrom \(irb\):1:in 'a17'\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `a16'\n/,
|
:*, /\tfrom \(irb\):1:in 'a16'\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `a15'\n/,
|
:*, /\tfrom \(irb\):1:in 'a15'\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `a14'\n/,
|
:*, /\tfrom \(irb\):1:in 'a14'\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `a13'\n/,
|
:*, /\tfrom \(irb\):1:in 'a13'\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `a12'\n/,
|
:*, /\tfrom \(irb\):1:in 'a12'\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `a11'\n/,
|
:*, /\tfrom \(irb\):1:in 'a11'\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `a10'\n/,
|
:*, /\tfrom \(irb\):1:in 'a10'\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `a9'\n/,
|
:*, /\tfrom \(irb\):1:in 'a9'\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `a8'\n/,
|
:*, /\tfrom \(irb\):1:in 'a8'\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `a7'\n/,
|
:*, /\tfrom \(irb\):1:in 'a7'\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `a6'\n/,
|
:*, /\tfrom \(irb\):1:in 'a6'\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `a5'\n/,
|
:*, /\tfrom \(irb\):1:in 'a5'\n/,
|
||||||
:*, /\tfrom \(irb\):1:in `a4'\n/,
|
:*, /\tfrom \(irb\):1:in 'a4'\n/,
|
||||||
:*, /\t... \d+ levels...\n/,
|
:*, /\t... \d+ levels...\n/,
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
|
@ -37,7 +37,7 @@ module TestIRB
|
|||||||
)
|
)
|
||||||
|
|
||||||
assert_empty(err)
|
assert_empty(err)
|
||||||
assert_match(/undefined local variable or method `__'/, out)
|
assert_match(/undefined local variable or method [`']__'/, out)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_eval_history_can_be_retrieved_with_double_underscore
|
def test_eval_history_can_be_retrieved_with_double_underscore
|
||||||
|
@ -61,7 +61,7 @@ IRB
|
|||||||
# TruffleRuby warns when the locale does not exist
|
# TruffleRuby warns when the locale does not exist
|
||||||
env['TRUFFLERUBYOPT'] = "#{ENV['TRUFFLERUBYOPT']} --log.level=SEVERE" if RUBY_ENGINE == 'truffleruby'
|
env['TRUFFLERUBYOPT'] = "#{ENV['TRUFFLERUBYOPT']} --log.level=SEVERE" if RUBY_ENGINE == 'truffleruby'
|
||||||
args = [env] + bundle_exec + %W[-rirb -C #{tmpdir} -W0 -e IRB.start(__FILE__) -- -f --]
|
args = [env] + bundle_exec + %W[-rirb -C #{tmpdir} -W0 -e IRB.start(__FILE__) -- -f --]
|
||||||
error = /`raise_euc_with_invalid_byte_sequence': あ\\xFF \(RuntimeError\)/
|
error = /[`']raise_euc_with_invalid_byte_sequence': あ\\xFF \(RuntimeError\)/
|
||||||
assert_in_out_err(args, <<~IRB, error, [], encoding: "UTF-8")
|
assert_in_out_err(args, <<~IRB, error, [], encoding: "UTF-8")
|
||||||
require_relative 'euc'
|
require_relative 'euc'
|
||||||
raise_euc_with_invalid_byte_sequence
|
raise_euc_with_invalid_byte_sequence
|
||||||
|
@ -171,7 +171,7 @@ class TestRipper::Lexer < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
BAD_CODE = [
|
BAD_CODE = [
|
||||||
[:parse_error, 'def req(true) end', %r[unexpected `true'], 'true'],
|
[:parse_error, 'def req(true) end', %r[unexpected 'true'], 'true'],
|
||||||
[:parse_error, 'def req(a, a) end', %r[duplicated argument name], 'a'],
|
[:parse_error, 'def req(a, a) end', %r[duplicated argument name], 'a'],
|
||||||
[:assign_error, 'begin; nil = 1; end', %r[assign to nil], 'nil'],
|
[:assign_error, 'begin; nil = 1; end', %r[assign to nil], 'nil'],
|
||||||
[:alias_error, 'begin; alias $x $1; end', %r[number variables], '$1'],
|
[:alias_error, 'begin; alias $x $1; end', %r[number variables], '$1'],
|
||||||
|
@ -1644,20 +1644,20 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_invalid_instance_variable_name
|
def test_invalid_instance_variable_name
|
||||||
assert_equal("`@1' is not allowed as an instance variable name", compile_error('proc{@1}'))
|
assert_equal("'@1' is not allowed as an instance variable name", compile_error('proc{@1}'))
|
||||||
assert_equal("`@' without identifiers is not allowed as an instance variable name", compile_error('@%'))
|
assert_equal("'@' without identifiers is not allowed as an instance variable name", compile_error('@%'))
|
||||||
assert_equal("`@' without identifiers is not allowed as an instance variable name", compile_error('@'))
|
assert_equal("'@' without identifiers is not allowed as an instance variable name", compile_error('@'))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_invalid_class_variable_name
|
def test_invalid_class_variable_name
|
||||||
assert_equal("`@@1' is not allowed as a class variable name", compile_error('@@1'))
|
assert_equal("'@@1' is not allowed as a class variable name", compile_error('@@1'))
|
||||||
assert_equal("`@@' without identifiers is not allowed as a class variable name", compile_error('@@%'))
|
assert_equal("'@@' without identifiers is not allowed as a class variable name", compile_error('@@%'))
|
||||||
assert_equal("`@@' without identifiers is not allowed as a class variable name", compile_error('@@'))
|
assert_equal("'@@' without identifiers is not allowed as a class variable name", compile_error('@@'))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_invalid_global_variable_name
|
def test_invalid_global_variable_name
|
||||||
assert_equal("`$%' is not allowed as a global variable name", compile_error('$%'))
|
assert_equal("'$%' is not allowed as a global variable name", compile_error('$%'))
|
||||||
assert_equal("`$' without identifiers is not allowed as a global variable name", compile_error('$'))
|
assert_equal("'$' without identifiers is not allowed as a global variable name", compile_error('$'))
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_warning_ignored_magic_comment
|
def test_warning_ignored_magic_comment
|
||||||
|
@ -216,7 +216,7 @@ class TestBacktrace < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
@line = __LINE__ + 1
|
@line = __LINE__ + 1
|
||||||
[1].map.map { [1].map.map { foo } }
|
[1].map.map { [1].map.map { foo } }
|
||||||
assert_equal("[\"#{__FILE__}:#{@line}:in `map'\"]", @res)
|
assert_equal("[\"#{__FILE__}:#{@line}:in 'map'\"]", @res)
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_caller_location_path_cfunc_iseq_no_pc
|
def test_caller_location_path_cfunc_iseq_no_pc
|
||||||
@ -384,11 +384,11 @@ class TestBacktrace < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_notty_backtrace
|
def test_notty_backtrace
|
||||||
err = ["-:1:in `<main>': unhandled exception"]
|
err = ["-:1:in '<main>': unhandled exception"]
|
||||||
assert_in_out_err([], "raise", [], err)
|
assert_in_out_err([], "raise", [], err)
|
||||||
|
|
||||||
err = ["-:2:in `foo': foo! (RuntimeError)",
|
err = ["-:2:in 'foo': foo! (RuntimeError)",
|
||||||
"\tfrom -:4:in `<main>'"]
|
"\tfrom -:4:in '<main>'"]
|
||||||
assert_in_out_err([], <<-"end;", [], err)
|
assert_in_out_err([], <<-"end;", [], err)
|
||||||
def foo
|
def foo
|
||||||
raise "foo!"
|
raise "foo!"
|
||||||
@ -396,12 +396,12 @@ class TestBacktrace < Test::Unit::TestCase
|
|||||||
foo
|
foo
|
||||||
end;
|
end;
|
||||||
|
|
||||||
err = ["-:7:in `rescue in bar': bar! (RuntimeError)",
|
err = ["-:7:in 'rescue in bar': bar! (RuntimeError)",
|
||||||
"\tfrom -:4:in `bar'",
|
"\tfrom -:4:in 'bar'",
|
||||||
"\tfrom -:9:in `<main>'",
|
"\tfrom -:9:in '<main>'",
|
||||||
"-:2:in `foo': foo! (RuntimeError)",
|
"-:2:in 'foo': foo! (RuntimeError)",
|
||||||
"\tfrom -:5:in `bar'",
|
"\tfrom -:5:in 'bar'",
|
||||||
"\tfrom -:9:in `<main>'"]
|
"\tfrom -:9:in '<main>'"]
|
||||||
assert_in_out_err([], <<-"end;", [], err)
|
assert_in_out_err([], <<-"end;", [], err)
|
||||||
def foo
|
def foo
|
||||||
raise "foo!"
|
raise "foo!"
|
||||||
@ -416,7 +416,7 @@ class TestBacktrace < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_caller_to_enum
|
def test_caller_to_enum
|
||||||
err = ["-:3:in `foo': unhandled exception", "\tfrom -:in `each'"]
|
err = ["-:3:in 'foo': unhandled exception", "\tfrom -:in 'each'"]
|
||||||
assert_in_out_err([], <<-"end;", [], err, "[ruby-core:91911]")
|
assert_in_out_err([], <<-"end;", [], err, "[ruby-core:91911]")
|
||||||
def foo
|
def foo
|
||||||
return to_enum(__method__) unless block_given?
|
return to_enum(__method__) unless block_given?
|
||||||
|
@ -67,7 +67,7 @@ class TestBeginEndBlock < Test::Unit::TestCase
|
|||||||
bug8501 = '[ruby-core:55365] [Bug #8501]'
|
bug8501 = '[ruby-core:55365] [Bug #8501]'
|
||||||
args = ['-e', 'o = Object.new; def o.inspect; raise "[Bug #8501]"; end',
|
args = ['-e', 'o = Object.new; def o.inspect; raise "[Bug #8501]"; end',
|
||||||
'-e', 'at_exit{o.nope}']
|
'-e', 'at_exit{o.nope}']
|
||||||
status = assert_in_out_err(args, '', [], /undefined method `nope'/, bug8501)
|
status = assert_in_out_err(args, '', [], /undefined method 'nope'/, bug8501)
|
||||||
assert_not_predicate(status, :success?, bug8501)
|
assert_not_predicate(status, :success?, bug8501)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -789,15 +789,15 @@ class TestClass < Test::Unit::TestCase
|
|||||||
c.attached_object
|
c.attached_object
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_raise_with_message(TypeError, /`NilClass' is not a singleton class/) do
|
assert_raise_with_message(TypeError, /'NilClass' is not a singleton class/) do
|
||||||
nil.singleton_class.attached_object
|
nil.singleton_class.attached_object
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_raise_with_message(TypeError, /`FalseClass' is not a singleton class/) do
|
assert_raise_with_message(TypeError, /'FalseClass' is not a singleton class/) do
|
||||||
false.singleton_class.attached_object
|
false.singleton_class.attached_object
|
||||||
end
|
end
|
||||||
|
|
||||||
assert_raise_with_message(TypeError, /`TrueClass' is not a singleton class/) do
|
assert_raise_with_message(TypeError, /'TrueClass' is not a singleton class/) do
|
||||||
true.singleton_class.attached_object
|
true.singleton_class.attached_object
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -809,7 +809,7 @@ end.join
|
|||||||
def test_cause_at_end
|
def test_cause_at_end
|
||||||
errs = [
|
errs = [
|
||||||
/-: unexpected return\n/,
|
/-: unexpected return\n/,
|
||||||
/.*undefined local variable or method `n'.*\n/,
|
/.*undefined local variable or method 'n'.*\n/,
|
||||||
]
|
]
|
||||||
assert_in_out_err([], <<-'end;', [], errs)
|
assert_in_out_err([], <<-'end;', [], errs)
|
||||||
END{n}; END{return}
|
END{n}; END{return}
|
||||||
@ -1045,7 +1045,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_message_of_name_error
|
def test_message_of_name_error
|
||||||
assert_raise_with_message(NameError, /\Aundefined method `foo' for module `#<Module:.*>'$/) do
|
assert_raise_with_message(NameError, /\Aundefined method 'foo' for module '#<Module:.*>'$/) do
|
||||||
Module.new do
|
Module.new do
|
||||||
module_function :foo
|
module_function :foo
|
||||||
end
|
end
|
||||||
@ -1093,7 +1093,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
|
|||||||
|
|
||||||
def test_warning_warn
|
def test_warning_warn
|
||||||
warning = capture_warning_warn {$asdfasdsda_test_warning_warn}
|
warning = capture_warning_warn {$asdfasdsda_test_warning_warn}
|
||||||
assert_match(/global variable `\$asdfasdsda_test_warning_warn' not initialized/, warning[0])
|
assert_match(/global variable '\$asdfasdsda_test_warning_warn' not initialized/, warning[0])
|
||||||
|
|
||||||
assert_equal(["a\nz\n"], capture_warning_warn {warn "a\n", "z"})
|
assert_equal(["a\nz\n"], capture_warning_warn {warn "a\n", "z"})
|
||||||
assert_equal([], capture_warning_warn {warn})
|
assert_equal([], capture_warning_warn {warn})
|
||||||
@ -1169,7 +1169,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_warning_warn_super
|
def test_warning_warn_super
|
||||||
assert_in_out_err(%[-W0], "#{<<~"{#"}\n#{<<~'};'}", [], /global variable `\$asdfiasdofa_test_warning_warn_super' not initialized/)
|
assert_in_out_err(%[-W0], "#{<<~"{#"}\n#{<<~'};'}", [], /global variable '\$asdfiasdofa_test_warning_warn_super' not initialized/)
|
||||||
{#
|
{#
|
||||||
module Warning
|
module Warning
|
||||||
def warn(message)
|
def warn(message)
|
||||||
@ -1443,7 +1443,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
|
|||||||
end
|
end
|
||||||
|
|
||||||
bug14670 = '[ruby-dev:50522] [Bug #14670]'
|
bug14670 = '[ruby-dev:50522] [Bug #14670]'
|
||||||
assert_raise_with_message(NoMethodError, /`foo'/, bug14670) do
|
assert_raise_with_message(NoMethodError, /'foo'/, bug14670) do
|
||||||
Object.new.foo
|
Object.new.foo
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
|
@ -157,12 +157,12 @@ class TestISeq < Test::Unit::TestCase
|
|||||||
y = nil.instance_eval do
|
y = nil.instance_eval do
|
||||||
eval("proc {#{name} = []; proc {|x| #{name}}}").call
|
eval("proc {#{name} = []; proc {|x| #{name}}}").call
|
||||||
end
|
end
|
||||||
assert_raise_with_message(Ractor::IsolationError, /`#{name}'/) do
|
assert_raise_with_message(Ractor::IsolationError, /'#{name}'/) do
|
||||||
Ractor.make_shareable(y)
|
Ractor.make_shareable(y)
|
||||||
end
|
end
|
||||||
obj = Object.new
|
obj = Object.new
|
||||||
def obj.foo(*) nil.instance_eval{ ->{super} } end
|
def obj.foo(*) nil.instance_eval{ ->{super} } end
|
||||||
assert_raise_with_message(Ractor::IsolationError, /refer unshareable object \[\] from variable `\*'/) do
|
assert_raise_with_message(Ractor::IsolationError, /refer unshareable object \[\] from variable '\*'/) do
|
||||||
Ractor.make_shareable(obj.foo)
|
Ractor.make_shareable(obj.foo)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@ -367,7 +367,7 @@ class TestISeq < Test::Unit::TestCase
|
|||||||
f.puts "end"
|
f.puts "end"
|
||||||
f.close
|
f.close
|
||||||
path = f.path
|
path = f.path
|
||||||
assert_in_out_err(%W[- #{path}], "#{<<-"begin;"}\n#{<<-"end;"}", /unexpected `end'/, [], success: true)
|
assert_in_out_err(%W[- #{path}], "#{<<-"begin;"}\n#{<<-"end;"}", /unexpected 'end'/, [], success: true)
|
||||||
begin;
|
begin;
|
||||||
path = ARGV[0]
|
path = ARGV[0]
|
||||||
begin
|
begin
|
||||||
|
@ -1453,12 +1453,12 @@ class TestMethod < Test::Unit::TestCase
|
|||||||
begin
|
begin
|
||||||
$f.call(1)
|
$f.call(1)
|
||||||
rescue ArgumentError => e
|
rescue ArgumentError => e
|
||||||
assert_equal "main.rb:#{$line_lambda}:in `block in <main>'", e.backtrace.first
|
assert_equal "main.rb:#{$line_lambda}:in 'block in <main>'", e.backtrace.first
|
||||||
end
|
end
|
||||||
begin
|
begin
|
||||||
foo(1)
|
foo(1)
|
||||||
rescue ArgumentError => e
|
rescue ArgumentError => e
|
||||||
assert_equal "main.rb:#{$line_method}:in `foo'", e.backtrace.first
|
assert_equal "main.rb:#{$line_method}:in 'foo'", e.backtrace.first
|
||||||
end
|
end
|
||||||
EOS
|
EOS
|
||||||
END_OF_BODY
|
END_OF_BODY
|
||||||
|
@ -1477,7 +1477,7 @@ class TestModule < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
%w(object_id __send__ initialize).each do |n|
|
%w(object_id __send__ initialize).each do |n|
|
||||||
assert_in_out_err([], <<-INPUT, [], %r"warning: undefining `#{n}' may cause serious problems$")
|
assert_in_out_err([], <<-INPUT, [], %r"warning: undefining '#{n}' may cause serious problems$")
|
||||||
$VERBOSE = false
|
$VERBOSE = false
|
||||||
Class.new.instance_eval { undef_method(:#{n}) }
|
Class.new.instance_eval { undef_method(:#{n}) }
|
||||||
INPUT
|
INPUT
|
||||||
@ -3348,7 +3348,7 @@ class TestModule < Test::Unit::TestCase
|
|||||||
methods = singleton_class.private_instance_methods(false)
|
methods = singleton_class.private_instance_methods(false)
|
||||||
assert_include(methods, :#{method}, ":#{method} should be private")
|
assert_include(methods, :#{method}, ":#{method} should be private")
|
||||||
|
|
||||||
assert_raise_with_message(NoMethodError, /^private method `#{method}' called for /) {
|
assert_raise_with_message(NoMethodError, /^private method '#{method}' called for /) {
|
||||||
recv = self
|
recv = self
|
||||||
recv.#{method}
|
recv.#{method}
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ class TestNoMethodError < Test::Unit::TestCase
|
|||||||
bug3237 = '[ruby-core:29948]'
|
bug3237 = '[ruby-core:29948]'
|
||||||
str = "\u2600"
|
str = "\u2600"
|
||||||
id = :"\u2604"
|
id = :"\u2604"
|
||||||
msg = "undefined method `#{id}' for an instance of String"
|
msg = "undefined method '#{id}' for an instance of String"
|
||||||
assert_raise_with_message(NoMethodError, Regexp.compile(Regexp.quote(msg)), bug3237) do
|
assert_raise_with_message(NoMethodError, Regexp.compile(Regexp.quote(msg)), bug3237) do
|
||||||
str.__send__(id)
|
str.__send__(id)
|
||||||
end
|
end
|
||||||
|
@ -480,12 +480,12 @@ class TestObject < Test::Unit::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_redefine_method_which_may_case_serious_problem
|
def test_redefine_method_which_may_case_serious_problem
|
||||||
assert_in_out_err([], <<-INPUT, [], %r"warning: redefining `object_id' may cause serious problems$")
|
assert_in_out_err([], <<-INPUT, [], %r"warning: redefining 'object_id' may cause serious problems$")
|
||||||
$VERBOSE = false
|
$VERBOSE = false
|
||||||
def (Object.new).object_id; end
|
def (Object.new).object_id; end
|
||||||
INPUT
|
INPUT
|
||||||
|
|
||||||
assert_in_out_err([], <<-INPUT, [], %r"warning: redefining `__send__' may cause serious problems$")
|
assert_in_out_err([], <<-INPUT, [], %r"warning: redefining '__send__' may cause serious problems$")
|
||||||
$VERBOSE = false
|
$VERBOSE = false
|
||||||
def (Object.new).__send__; end
|
def (Object.new).__send__; end
|
||||||
INPUT
|
INPUT
|
||||||
@ -528,7 +528,7 @@ class TestObject < Test::Unit::TestCase
|
|||||||
assert_raise(NoMethodError, bug2202) {o2.meth2}
|
assert_raise(NoMethodError, bug2202) {o2.meth2}
|
||||||
|
|
||||||
%w(object_id __send__ initialize).each do |m|
|
%w(object_id __send__ initialize).each do |m|
|
||||||
assert_in_out_err([], <<-INPUT, %w(:ok), %r"warning: removing `#{m}' may cause serious problems$")
|
assert_in_out_err([], <<-INPUT, %w(:ok), %r"warning: removing '#{m}' may cause serious problems$")
|
||||||
$VERBOSE = false
|
$VERBOSE = false
|
||||||
begin
|
begin
|
||||||
Class.new.instance_eval { remove_method(:#{m}) }
|
Class.new.instance_eval { remove_method(:#{m}) }
|
||||||
|
@ -378,10 +378,10 @@ class TestParse < Test::Unit::TestCase
|
|||||||
|
|
||||||
def assert_disallowed_variable(type, noname, invalid)
|
def assert_disallowed_variable(type, noname, invalid)
|
||||||
noname.each do |name|
|
noname.each do |name|
|
||||||
assert_syntax_error("proc{a = #{name} }", "`#{noname[0]}' without identifiers is not allowed as #{type} variable name")
|
assert_syntax_error("proc{a = #{name} }", "'#{noname[0]}' without identifiers is not allowed as #{type} variable name")
|
||||||
end
|
end
|
||||||
invalid.each do |name|
|
invalid.each do |name|
|
||||||
assert_syntax_error("proc {a = #{name} }", "`#{name}' is not allowed as #{type} variable name")
|
assert_syntax_error("proc {a = #{name} }", "'#{name}' is not allowed as #{type} variable name")
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -854,7 +854,7 @@ x = __ENCODING__
|
|||||||
|
|
||||||
def test_float
|
def test_float
|
||||||
assert_predicate(assert_warning(/out of range/) {eval("1e10000")}, :infinite?)
|
assert_predicate(assert_warning(/out of range/) {eval("1e10000")}, :infinite?)
|
||||||
assert_syntax_error('1_E', /trailing `_'/)
|
assert_syntax_error('1_E', /trailing '_'/)
|
||||||
assert_syntax_error('1E1E1', /unexpected constant/)
|
assert_syntax_error('1E1E1', /unexpected constant/)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -882,7 +882,7 @@ x = __ENCODING__
|
|||||||
|
|
||||||
def test_invalid_char
|
def test_invalid_char
|
||||||
bug10117 = '[ruby-core:64243] [Bug #10117]'
|
bug10117 = '[ruby-core:64243] [Bug #10117]'
|
||||||
invalid_char = /Invalid char `\\x01'/
|
invalid_char = /Invalid char '\\x01'/
|
||||||
x = 1
|
x = 1
|
||||||
assert_in_out_err(%W"-e \x01x", "", [], invalid_char, bug10117)
|
assert_in_out_err(%W"-e \x01x", "", [], invalid_char, bug10117)
|
||||||
assert_syntax_error("\x01x", invalid_char, bug10117)
|
assert_syntax_error("\x01x", invalid_char, bug10117)
|
||||||
@ -952,14 +952,14 @@ x = __ENCODING__
|
|||||||
|
|
||||||
def test_assign_in_conditional
|
def test_assign_in_conditional
|
||||||
# multiple assignment
|
# multiple assignment
|
||||||
assert_warning(/`= literal' in conditional/) do
|
assert_warning(/'= literal' in conditional/) do
|
||||||
eval <<-END, nil, __FILE__, __LINE__+1
|
eval <<-END, nil, __FILE__, __LINE__+1
|
||||||
(x, y = 1, 2) ? 1 : 2
|
(x, y = 1, 2) ? 1 : 2
|
||||||
END
|
END
|
||||||
end
|
end
|
||||||
|
|
||||||
# instance variable assignment
|
# instance variable assignment
|
||||||
assert_warning(/`= literal' in conditional/) do
|
assert_warning(/'= literal' in conditional/) do
|
||||||
eval <<-END, nil, __FILE__, __LINE__+1
|
eval <<-END, nil, __FILE__, __LINE__+1
|
||||||
if @x = true
|
if @x = true
|
||||||
1
|
1
|
||||||
@ -970,7 +970,7 @@ x = __ENCODING__
|
|||||||
end
|
end
|
||||||
|
|
||||||
# local variable assignment
|
# local variable assignment
|
||||||
assert_warning(/`= literal' in conditional/) do
|
assert_warning(/'= literal' in conditional/) do
|
||||||
eval <<-END, nil, __FILE__, __LINE__+1
|
eval <<-END, nil, __FILE__, __LINE__+1
|
||||||
def m
|
def m
|
||||||
if x = true
|
if x = true
|
||||||
@ -984,7 +984,7 @@ x = __ENCODING__
|
|||||||
|
|
||||||
# global variable assignment
|
# global variable assignment
|
||||||
assert_separately([], <<-RUBY)
|
assert_separately([], <<-RUBY)
|
||||||
assert_warning(/`= literal' in conditional/) do
|
assert_warning(/'= literal' in conditional/) do
|
||||||
eval <<-END, nil, __FILE__, __LINE__+1
|
eval <<-END, nil, __FILE__, __LINE__+1
|
||||||
if $x = true
|
if $x = true
|
||||||
1
|
1
|
||||||
@ -996,7 +996,7 @@ x = __ENCODING__
|
|||||||
RUBY
|
RUBY
|
||||||
|
|
||||||
# dynamic variable assignment
|
# dynamic variable assignment
|
||||||
assert_warning(/`= literal' in conditional/) do
|
assert_warning(/'= literal' in conditional/) do
|
||||||
eval <<-END, nil, __FILE__, __LINE__+1
|
eval <<-END, nil, __FILE__, __LINE__+1
|
||||||
y = 1
|
y = 1
|
||||||
|
|
||||||
@ -1011,7 +1011,7 @@ x = __ENCODING__
|
|||||||
end
|
end
|
||||||
|
|
||||||
# class variable assignment
|
# class variable assignment
|
||||||
assert_warning(/`= literal' in conditional/) do
|
assert_warning(/'= literal' in conditional/) do
|
||||||
eval <<-END, nil, __FILE__, __LINE__+1
|
eval <<-END, nil, __FILE__, __LINE__+1
|
||||||
c = Class.new
|
c = Class.new
|
||||||
class << c
|
class << c
|
||||||
@ -1023,7 +1023,7 @@ x = __ENCODING__
|
|||||||
|
|
||||||
# constant declaration
|
# constant declaration
|
||||||
assert_separately([], <<-RUBY)
|
assert_separately([], <<-RUBY)
|
||||||
assert_warning(/`= literal' in conditional/) do
|
assert_warning(/'= literal' in conditional/) do
|
||||||
eval <<-END, nil, __FILE__, __LINE__+1
|
eval <<-END, nil, __FILE__, __LINE__+1
|
||||||
if Const = true
|
if Const = true
|
||||||
1
|
1
|
||||||
|
@ -117,7 +117,7 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||||||
assert_in_out_err(%w(-W:no-experimental -e) + ['p Warning[:experimental]'], "", %w(false), [])
|
assert_in_out_err(%w(-W:no-experimental -e) + ['p Warning[:experimental]'], "", %w(false), [])
|
||||||
assert_in_out_err(%w(-W -e) + ['p Warning[:performance]'], "", %w(false), [])
|
assert_in_out_err(%w(-W -e) + ['p Warning[:performance]'], "", %w(false), [])
|
||||||
assert_in_out_err(%w(-W:performance -e) + ['p Warning[:performance]'], "", %w(true), [])
|
assert_in_out_err(%w(-W:performance -e) + ['p Warning[:performance]'], "", %w(true), [])
|
||||||
assert_in_out_err(%w(-W:qux), "", [], /unknown warning category: `qux'/)
|
assert_in_out_err(%w(-W:qux), "", [], /unknown warning category: 'qux'/)
|
||||||
assert_in_out_err(%w(-w -e) + ['p Warning[:deprecated]'], "", %w(true), [])
|
assert_in_out_err(%w(-w -e) + ['p Warning[:deprecated]'], "", %w(true), [])
|
||||||
assert_in_out_err(%w(-W -e) + ['p Warning[:deprecated]'], "", %w(true), [])
|
assert_in_out_err(%w(-W -e) + ['p Warning[:deprecated]'], "", %w(true), [])
|
||||||
assert_in_out_err(%w(-We) + ['p Warning[:deprecated]'], "", %w(true), [])
|
assert_in_out_err(%w(-We) + ['p Warning[:deprecated]'], "", %w(true), [])
|
||||||
@ -204,7 +204,7 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||||||
assert_in_out_err(%w(--enable=all --disable=rjit -e) + [""], "", [], [])
|
assert_in_out_err(%w(--enable=all --disable=rjit -e) + [""], "", [], [])
|
||||||
end
|
end
|
||||||
assert_in_out_err(%w(--enable foobarbazqux -e) + [""], "", [],
|
assert_in_out_err(%w(--enable foobarbazqux -e) + [""], "", [],
|
||||||
/unknown argument for --enable: `foobarbazqux'/)
|
/unknown argument for --enable: 'foobarbazqux'/)
|
||||||
assert_in_out_err(%w(--enable), "", [], /missing argument for --enable/)
|
assert_in_out_err(%w(--enable), "", [], /missing argument for --enable/)
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -213,7 +213,7 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||||||
assert_in_out_err(%w(--disable-all -e) + [""], "", [], [])
|
assert_in_out_err(%w(--disable-all -e) + [""], "", [], [])
|
||||||
assert_in_out_err(%w(--disable=all -e) + [""], "", [], [])
|
assert_in_out_err(%w(--disable=all -e) + [""], "", [], [])
|
||||||
assert_in_out_err(%w(--disable foobarbazqux -e) + [""], "", [],
|
assert_in_out_err(%w(--disable foobarbazqux -e) + [""], "", [],
|
||||||
/unknown argument for --disable: `foobarbazqux'/)
|
/unknown argument for --disable: 'foobarbazqux'/)
|
||||||
assert_in_out_err(%w(--disable), "", [], /missing argument for --disable/)
|
assert_in_out_err(%w(--disable), "", [], /missing argument for --disable/)
|
||||||
assert_in_out_err(%w(-e) + ['p defined? Gem'], "", ["nil"], [])
|
assert_in_out_err(%w(-e) + ['p defined? Gem'], "", ["nil"], [])
|
||||||
assert_in_out_err(%w(--disable-did_you_mean -e) + ['p defined? DidYouMean'], "", ["nil"], [])
|
assert_in_out_err(%w(--disable-did_you_mean -e) + ['p defined? DidYouMean'], "", ["nil"], [])
|
||||||
@ -443,7 +443,7 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||||||
ENV['RUBYOPT'] = '-W:no-experimental'
|
ENV['RUBYOPT'] = '-W:no-experimental'
|
||||||
assert_in_out_err(%w(), "p Warning[:experimental]", ["false"])
|
assert_in_out_err(%w(), "p Warning[:experimental]", ["false"])
|
||||||
ENV['RUBYOPT'] = '-W:qux'
|
ENV['RUBYOPT'] = '-W:qux'
|
||||||
assert_in_out_err(%w(), "", [], /unknown warning category: `qux'/)
|
assert_in_out_err(%w(), "", [], /unknown warning category: 'qux'/)
|
||||||
|
|
||||||
ENV['RUBYOPT'] = 'w'
|
ENV['RUBYOPT'] = 'w'
|
||||||
assert_in_out_err(%w(), "p $VERBOSE", ["true"])
|
assert_in_out_err(%w(), "p $VERBOSE", ["true"])
|
||||||
@ -558,7 +558,7 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||||||
t.puts " end"
|
t.puts " end"
|
||||||
t.puts "end"
|
t.puts "end"
|
||||||
t.flush
|
t.flush
|
||||||
warning = ' warning: found `= literal\' in conditional, should be =='
|
warning = ' warning: found \'= literal\' in conditional, should be =='
|
||||||
err = ["#{t.path}:1:#{warning}",
|
err = ["#{t.path}:1:#{warning}",
|
||||||
"#{t.path}:4:#{warning}",
|
"#{t.path}:4:#{warning}",
|
||||||
]
|
]
|
||||||
@ -820,8 +820,8 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||||||
%r(
|
%r(
|
||||||
(?:
|
(?:
|
||||||
--\sRuby\slevel\sbacktrace\sinformation\s----------------------------------------\n
|
--\sRuby\slevel\sbacktrace\sinformation\s----------------------------------------\n
|
||||||
(?:-e:1:in\s\`(?:block\sin\s)?<main>\'\n)*
|
(?:-e:1:in\s\'(?:block\sin\s)?<main>\'\n)*
|
||||||
-e:1:in\s\`kill\'\n
|
-e:1:in\s\'kill\'\n
|
||||||
\n
|
\n
|
||||||
)?
|
)?
|
||||||
)x,
|
)x,
|
||||||
|
@ -1123,9 +1123,9 @@ CODE
|
|||||||
when :line
|
when :line
|
||||||
assert_match(/ in /, str)
|
assert_match(/ in /, str)
|
||||||
when :call, :c_call
|
when :call, :c_call
|
||||||
assert_match(/call \`/, str) # #<TracePoint:c_call `inherited' ../trunk/test.rb:11>
|
assert_match(/call \'/, str) # #<TracePoint:c_call 'inherited' ../trunk/test.rb:11>
|
||||||
when :return, :c_return
|
when :return, :c_return
|
||||||
assert_match(/return \`/, str) # #<TracePoint:return `m' ../trunk/test.rb:3>
|
assert_match(/return \'/, str) # #<TracePoint:return 'm' ../trunk/test.rb:3>
|
||||||
when /thread/
|
when /thread/
|
||||||
assert_match(/\#<Thread:/, str) # #<TracePoint:thread_end of #<Thread:0x87076c0>>
|
assert_match(/\#<Thread:/, str) # #<TracePoint:thread_end of #<Thread:0x87076c0>>
|
||||||
else
|
else
|
||||||
|
@ -491,7 +491,7 @@ class TestSyntax < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_warn_balanced
|
def test_warn_balanced
|
||||||
warning = <<WARN
|
warning = <<WARN
|
||||||
test:1: warning: `%s' after local variable or literal is interpreted as binary operator
|
test:1: warning: '%s' after local variable or literal is interpreted as binary operator
|
||||||
test:1: warning: even though it seems like %s
|
test:1: warning: even though it seems like %s
|
||||||
WARN
|
WARN
|
||||||
[
|
[
|
||||||
@ -699,7 +699,7 @@ WARN
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_duplicated_when
|
def test_duplicated_when
|
||||||
w = 'warning: duplicated `when\' clause with line 3 is ignored'
|
w = 'warning: duplicated \'when\' clause with line 3 is ignored'
|
||||||
assert_warning(/3: #{w}.+4: #{w}.+4: #{w}.+5: #{w}.+5: #{w}/m) {
|
assert_warning(/3: #{w}.+4: #{w}.+4: #{w}.+5: #{w}.+5: #{w}/m) {
|
||||||
eval %q{
|
eval %q{
|
||||||
case 1
|
case 1
|
||||||
@ -740,7 +740,7 @@ WARN
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_duplicated_when_check_option
|
def test_duplicated_when_check_option
|
||||||
w = /duplicated `when\' clause with line 3 is ignored/
|
w = /duplicated \'when\' clause with line 3 is ignored/
|
||||||
assert_in_out_err(%[-wc], "#{<<~"begin;"}\n#{<<~'end;'}", ["Syntax OK"], w)
|
assert_in_out_err(%[-wc], "#{<<~"begin;"}\n#{<<~'end;'}", ["Syntax OK"], w)
|
||||||
begin;
|
begin;
|
||||||
case 1
|
case 1
|
||||||
@ -1315,7 +1315,7 @@ eom
|
|||||||
end
|
end
|
||||||
|
|
||||||
def test_parenthesised_statement_argument
|
def test_parenthesised_statement_argument
|
||||||
assert_syntax_error("foo(bar rescue nil)", /unexpected `rescue' modifier/)
|
assert_syntax_error("foo(bar rescue nil)", /unexpected 'rescue' modifier/)
|
||||||
assert_valid_syntax("foo (bar rescue nil)")
|
assert_valid_syntax("foo (bar rescue nil)")
|
||||||
end
|
end
|
||||||
|
|
||||||
@ -1803,7 +1803,7 @@ eom
|
|||||||
assert_syntax_error('def x(_4) end', /_4 is reserved for numbered parameter/)
|
assert_syntax_error('def x(_4) end', /_4 is reserved for numbered parameter/)
|
||||||
assert_syntax_error('def _5; end', /_5 is reserved for numbered parameter/)
|
assert_syntax_error('def _5; end', /_5 is reserved for numbered parameter/)
|
||||||
assert_syntax_error('def self._6; end', /_6 is reserved for numbered parameter/)
|
assert_syntax_error('def self._6; end', /_6 is reserved for numbered parameter/)
|
||||||
assert_raise_with_message(NameError, /undefined local variable or method `_1'/) {
|
assert_raise_with_message(NameError, /undefined local variable or method '_1'/) {
|
||||||
eval('_1')
|
eval('_1')
|
||||||
}
|
}
|
||||||
['class C', 'class << C', 'module M', 'def m', 'def o.m'].each do |c|
|
['class C', 'class << C', 'module M', 'def m', 'def o.m'].each do |c|
|
||||||
@ -1826,12 +1826,12 @@ eom
|
|||||||
|
|
||||||
def test_it
|
def test_it
|
||||||
assert_valid_syntax('proc {it}')
|
assert_valid_syntax('proc {it}')
|
||||||
assert_syntax_error('[1,2].then {it+_2}', /`it` is already used/)
|
assert_syntax_error('[1,2].then {it+_2}', /'it' is already used/)
|
||||||
assert_syntax_error('[1,2].then {_2+it}', /numbered parameter is already used/)
|
assert_syntax_error('[1,2].then {_2+it}', /numbered parameter is already used/)
|
||||||
assert_equal([1, 2], eval('[1,2].then {it}'))
|
assert_equal([1, 2], eval('[1,2].then {it}'))
|
||||||
assert_syntax_error('[1,2].then {"#{it}#{_2}"}', /`it` is already used/)
|
assert_syntax_error('[1,2].then {"#{it}#{_2}"}', /'it' is already used/)
|
||||||
assert_syntax_error('[1,2].then {"#{_2}#{it}"}', /numbered parameter is already used/)
|
assert_syntax_error('[1,2].then {"#{_2}#{it}"}', /numbered parameter is already used/)
|
||||||
assert_syntax_error('->{it+_2}.call(1,2)', /`it` is already used/)
|
assert_syntax_error('->{it+_2}.call(1,2)', /'it' is already used/)
|
||||||
assert_syntax_error('->{_2+it}.call(1,2)', /numbered parameter is already used/)
|
assert_syntax_error('->{_2+it}.call(1,2)', /numbered parameter is already used/)
|
||||||
assert_equal(4, eval('->(a=->{it}){a}.call.call(4)'))
|
assert_equal(4, eval('->(a=->{it}){a}.call.call(4)'))
|
||||||
assert_equal(5, eval('-> a: ->{it} {a}.call.call(5)'))
|
assert_equal(5, eval('-> a: ->{it} {a}.call.call(5)'))
|
||||||
@ -1857,7 +1857,7 @@ eom
|
|||||||
assert_equal(4, eval('a=Object.new; def a.foo(it); it; end; a.foo(4)'))
|
assert_equal(4, eval('a=Object.new; def a.foo(it); it; end; a.foo(4)'))
|
||||||
assert_equal(5, eval('a=Object.new; def a.it; 5; end; a.it'))
|
assert_equal(5, eval('a=Object.new; def a.it; 5; end; a.it'))
|
||||||
assert_equal(6, eval('a=Class.new; a.class_eval{ def it; 6; end }; a.new.it'))
|
assert_equal(6, eval('a=Class.new; a.class_eval{ def it; 6; end }; a.new.it'))
|
||||||
assert_raise_with_message(NameError, /undefined local variable or method `it'/) do
|
assert_raise_with_message(NameError, /undefined local variable or method 'it'/) do
|
||||||
eval('it')
|
eval('it')
|
||||||
end
|
end
|
||||||
['class C', 'class << C', 'module M', 'def m', 'def o.m'].each do |c|
|
['class C', 'class << C', 'module M', 'def m', 'def o.m'].each do |c|
|
||||||
|
@ -17,7 +17,7 @@ class GemTest < Gem::TestCase
|
|||||||
|
|
||||||
output = Gem::Util.popen(*ruby_with_rubygems_and_fake_operating_system_in_load_path(path), "-e", "'require \"rubygems\"'", { err: [:child, :out] }).strip
|
output = Gem::Util.popen(*ruby_with_rubygems_and_fake_operating_system_in_load_path(path), "-e", "'require \"rubygems\"'", { err: [:child, :out] }).strip
|
||||||
assert !$?.success?
|
assert !$?.success?
|
||||||
assert_includes output, "undefined local variable or method `intentionally_not_implemented_method'"
|
assert_includes output, "undefined local variable or method 'intentionally_not_implemented_method'"
|
||||||
assert_includes output, "Loading the #{operating_system_rb_at(path)} file caused an error. " \
|
assert_includes output, "Loading the #{operating_system_rb_at(path)} file caused an error. " \
|
||||||
"This file is owned by your OS, not by rubygems upstream. " \
|
"This file is owned by your OS, not by rubygems upstream. " \
|
||||||
"Please find out which OS package this file belongs to and follow the guidelines from your OS to report " \
|
"Please find out which OS package this file belongs to and follow the guidelines from your OS to report " \
|
||||||
|
@ -306,7 +306,7 @@ class TestForwardable < Test::Unit::TestCase
|
|||||||
|
|
||||||
def test_basicobject_subclass
|
def test_basicobject_subclass
|
||||||
bug11616 = '[ruby-core:71176] [Bug #11616]'
|
bug11616 = '[ruby-core:71176] [Bug #11616]'
|
||||||
assert_raise_with_message(NameError, /`bar'/, bug11616) {
|
assert_raise_with_message(NameError, /'bar'/, bug11616) {
|
||||||
Foo2.new.baz
|
Foo2.new.baz
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
2
thread.c
2
thread.c
@ -888,7 +888,7 @@ thread_s_new(int argc, VALUE *argv, VALUE klass)
|
|||||||
rb_obj_call_init_kw(thread, argc, argv, RB_PASS_CALLED_KEYWORDS);
|
rb_obj_call_init_kw(thread, argc, argv, RB_PASS_CALLED_KEYWORDS);
|
||||||
th = rb_thread_ptr(thread);
|
th = rb_thread_ptr(thread);
|
||||||
if (!threadptr_initialized(th)) {
|
if (!threadptr_initialized(th)) {
|
||||||
rb_raise(rb_eThreadError, "uninitialized thread - check `%"PRIsVALUE"#initialize'",
|
rb_raise(rb_eThreadError, "uninitialized thread - check '%"PRIsVALUE"#initialize'",
|
||||||
klass);
|
klass);
|
||||||
}
|
}
|
||||||
return thread;
|
return thread;
|
||||||
|
8
time.c
8
time.c
@ -650,13 +650,13 @@ wv2timet(wideval_t w)
|
|||||||
wideint_t wi = FIXWV2WINT(w);
|
wideint_t wi = FIXWV2WINT(w);
|
||||||
if (TIMET_MIN == 0) {
|
if (TIMET_MIN == 0) {
|
||||||
if (wi < 0)
|
if (wi < 0)
|
||||||
rb_raise(rb_eRangeError, "negative value to convert into `time_t'");
|
rb_raise(rb_eRangeError, "negative value to convert into 'time_t'");
|
||||||
if (TIMET_MAX < (uwideint_t)wi)
|
if (TIMET_MAX < (uwideint_t)wi)
|
||||||
rb_raise(rb_eRangeError, "too big to convert into `time_t'");
|
rb_raise(rb_eRangeError, "too big to convert into 'time_t'");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (wi < TIMET_MIN || TIMET_MAX < wi)
|
if (wi < TIMET_MIN || TIMET_MAX < wi)
|
||||||
rb_raise(rb_eRangeError, "too big to convert into `time_t'");
|
rb_raise(rb_eRangeError, "too big to convert into 'time_t'");
|
||||||
}
|
}
|
||||||
return (time_t)wi;
|
return (time_t)wi;
|
||||||
}
|
}
|
||||||
@ -2520,7 +2520,7 @@ two_digits(const char *ptr, const char *end, const char **endp, const char *name
|
|||||||
((len > 2) && ISDIGIT(ptr[2]))) {
|
((len > 2) && ISDIGIT(ptr[2]))) {
|
||||||
VALUE mesg = rb_sprintf("two digits %s is expected", name);
|
VALUE mesg = rb_sprintf("two digits %s is expected", name);
|
||||||
if (ptr[-1] == '-' || ptr[-1] == ':') {
|
if (ptr[-1] == '-' || ptr[-1] == ':') {
|
||||||
rb_str_catf(mesg, " after `%c'", ptr[-1]);
|
rb_str_catf(mesg, " after '%c'", ptr[-1]);
|
||||||
}
|
}
|
||||||
rb_str_catf(mesg, ": %.*s", ((len > 10) ? 10 : (int)(end - ptr)) + 1, ptr - 1);
|
rb_str_catf(mesg, ": %.*s", ((len > 10) ? 10 : (int)(end - ptr)) + 1, ptr - 1);
|
||||||
rb_exc_raise(rb_exc_new_str(rb_eArgError, mesg));
|
rb_exc_raise(rb_exc_new_str(rb_eArgError, mesg));
|
||||||
|
@ -532,7 +532,7 @@ rb_global_entry(ID id)
|
|||||||
VALUE
|
VALUE
|
||||||
rb_gvar_undef_getter(ID id, VALUE *_)
|
rb_gvar_undef_getter(ID id, VALUE *_)
|
||||||
{
|
{
|
||||||
rb_warning("global variable `%"PRIsVALUE"' not initialized", QUOTE_ID(id));
|
rb_warning("global variable '%"PRIsVALUE"' not initialized", QUOTE_ID(id));
|
||||||
|
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
@ -906,7 +906,7 @@ rb_gv_get(const char *name)
|
|||||||
ID id = find_global_id(name);
|
ID id = find_global_id(name);
|
||||||
|
|
||||||
if (!id) {
|
if (!id) {
|
||||||
rb_warning("global variable `%s' not initialized", name);
|
rb_warning("global variable '%s' not initialized", name);
|
||||||
return Qnil;
|
return Qnil;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2198,7 +2198,7 @@ rb_obj_instance_variables(VALUE obj)
|
|||||||
#define rb_is_constant_id rb_is_const_id
|
#define rb_is_constant_id rb_is_const_id
|
||||||
#define rb_is_constant_name rb_is_const_name
|
#define rb_is_constant_name rb_is_const_name
|
||||||
#define id_for_var(obj, name, part, type) \
|
#define id_for_var(obj, name, part, type) \
|
||||||
id_for_var_message(obj, name, type, "`%1$s' is not allowed as "#part" "#type" variable name")
|
id_for_var_message(obj, name, type, "'%1$s' is not allowed as "#part" "#type" variable name")
|
||||||
#define id_for_var_message(obj, name, type, message) \
|
#define id_for_var_message(obj, name, type, message) \
|
||||||
check_id_type(obj, &(name), rb_is_##type##_id, rb_is_##type##_name, message, strlen(message))
|
check_id_type(obj, &(name), rb_is_##type##_id, rb_is_##type##_name, message, strlen(message))
|
||||||
static ID
|
static ID
|
||||||
@ -3693,7 +3693,7 @@ rb_define_const(VALUE klass, const char *name, VALUE val)
|
|||||||
ID id = rb_intern(name);
|
ID id = rb_intern(name);
|
||||||
|
|
||||||
if (!rb_is_const_id(id)) {
|
if (!rb_is_const_id(id)) {
|
||||||
rb_warn("rb_define_const: invalid name `%s' for constant", name);
|
rb_warn("rb_define_const: invalid name '%s' for constant", name);
|
||||||
}
|
}
|
||||||
rb_gc_register_mark_object(val);
|
rb_gc_register_mark_object(val);
|
||||||
rb_const_set(klass, id, val);
|
rb_const_set(klass, id, val);
|
||||||
|
6
vm.c
6
vm.c
@ -1246,7 +1246,7 @@ env_copy(const VALUE *src_ep, VALUE read_only_variables)
|
|||||||
VALUE msg = rb_sprintf("can not make shareable Proc because it can refer"
|
VALUE msg = rb_sprintf("can not make shareable Proc because it can refer"
|
||||||
" unshareable object %+" PRIsVALUE " from ", v);
|
" unshareable object %+" PRIsVALUE " from ", v);
|
||||||
if (name)
|
if (name)
|
||||||
rb_str_catf(msg, "variable `%" PRIsVALUE "'", name);
|
rb_str_catf(msg, "variable '%" PRIsVALUE "'", name);
|
||||||
else
|
else
|
||||||
rb_str_cat_cstr(msg, "a hidden variable");
|
rb_str_cat_cstr(msg, "a hidden variable");
|
||||||
rb_exc_raise(rb_exc_new_str(rb_eRactorIsolationError, msg));
|
rb_exc_raise(rb_exc_new_str(rb_eRactorIsolationError, msg));
|
||||||
@ -1305,11 +1305,11 @@ proc_shared_outer_variables(struct rb_id_table *outer_variables, bool isolate, c
|
|||||||
rb_str_append(str, name);
|
rb_str_append(str, name);
|
||||||
}
|
}
|
||||||
if (*sep == ',') rb_str_cat_cstr(str, ")");
|
if (*sep == ',') rb_str_cat_cstr(str, ")");
|
||||||
rb_str_cat_cstr(str, data.yield ? " and uses `yield'." : ".");
|
rb_str_cat_cstr(str, data.yield ? " and uses 'yield'." : ".");
|
||||||
rb_exc_raise(rb_exc_new_str(rb_eArgError, str));
|
rb_exc_raise(rb_exc_new_str(rb_eArgError, str));
|
||||||
}
|
}
|
||||||
else if (data.yield) {
|
else if (data.yield) {
|
||||||
rb_raise(rb_eArgError, "can not %s because it uses `yield'.", message);
|
rb_raise(rb_eArgError, "can not %s because it uses 'yield'.", message);
|
||||||
}
|
}
|
||||||
|
|
||||||
return data.read_only;
|
return data.read_only;
|
||||||
|
@ -396,7 +396,7 @@ location_format(VALUE file, int lineno, VALUE name)
|
|||||||
rb_str_cat_cstr(s, "unknown method");
|
rb_str_cat_cstr(s, "unknown method");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_str_catf(s, "`%s'", RSTRING_PTR(name));
|
rb_str_catf(s, "'%s'", RSTRING_PTR(name));
|
||||||
}
|
}
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
@ -973,7 +973,7 @@ oldbt_print(void *data, VALUE file, int lineno, VALUE name)
|
|||||||
RSTRING_PTR(file), lineno);
|
RSTRING_PTR(file), lineno);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(fp, "\tfrom %s:%d:in `%s'\n",
|
fprintf(fp, "\tfrom %s:%d:in '%s'\n",
|
||||||
RSTRING_PTR(file), lineno, RSTRING_PTR(name));
|
RSTRING_PTR(file), lineno, RSTRING_PTR(name));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1012,7 +1012,7 @@ oldbt_bugreport(void *arg, VALUE file, int line, VALUE method)
|
|||||||
fprintf(fp, "%s:%d:in unknown method\n", filename, line);
|
fprintf(fp, "%s:%d:in unknown method\n", filename, line);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fprintf(fp, "%s:%d:in `%s'\n", filename, line, RSTRING_PTR(method));
|
fprintf(fp, "%s:%d:in '%s'\n", filename, line, RSTRING_PTR(method));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1053,7 +1053,7 @@ oldbt_print_to(void *data, VALUE file, int lineno, VALUE name)
|
|||||||
rb_str_cat2(str, "unknown method\n");
|
rb_str_cat2(str, "unknown method\n");
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_str_catf(str, " `%"PRIsVALUE"'\n", name);
|
rb_str_catf(str, " '%"PRIsVALUE"'\n", name);
|
||||||
}
|
}
|
||||||
(*arg->iter)(arg->output, str);
|
(*arg->iter)(arg->output, str);
|
||||||
}
|
}
|
||||||
|
20
vm_eval.c
20
vm_eval.c
@ -800,29 +800,29 @@ uncallable_object(VALUE recv, ID mid)
|
|||||||
|
|
||||||
if (SPECIAL_CONST_P(recv)) {
|
if (SPECIAL_CONST_P(recv)) {
|
||||||
rb_raise(rb_eNotImpError,
|
rb_raise(rb_eNotImpError,
|
||||||
"method `%"PRIsVALUE"' called on unexpected immediate object (%p)",
|
"method '%"PRIsVALUE"' called on unexpected immediate object (%p)",
|
||||||
mname, (void *)recv);
|
mname, (void *)recv);
|
||||||
}
|
}
|
||||||
else if ((flags = RBASIC(recv)->flags) == 0) {
|
else if ((flags = RBASIC(recv)->flags) == 0) {
|
||||||
rb_raise(rb_eNotImpError,
|
rb_raise(rb_eNotImpError,
|
||||||
"method `%"PRIsVALUE"' called on terminated object (%p)",
|
"method '%"PRIsVALUE"' called on terminated object (%p)",
|
||||||
mname, (void *)recv);
|
mname, (void *)recv);
|
||||||
}
|
}
|
||||||
else if (!(typestr = rb_type_str(type = BUILTIN_TYPE(recv)))) {
|
else if (!(typestr = rb_type_str(type = BUILTIN_TYPE(recv)))) {
|
||||||
rb_raise(rb_eNotImpError,
|
rb_raise(rb_eNotImpError,
|
||||||
"method `%"PRIsVALUE"' called on broken T_?""?""?(0x%02x) object"
|
"method '%"PRIsVALUE"' called on broken T_?""?""?(0x%02x) object"
|
||||||
" (%p flags=0x%"PRIxVALUE")",
|
" (%p flags=0x%"PRIxVALUE")",
|
||||||
mname, type, (void *)recv, flags);
|
mname, type, (void *)recv, flags);
|
||||||
}
|
}
|
||||||
else if (T_OBJECT <= type && type < T_NIL) {
|
else if (T_OBJECT <= type && type < T_NIL) {
|
||||||
rb_raise(rb_eNotImpError,
|
rb_raise(rb_eNotImpError,
|
||||||
"method `%"PRIsVALUE"' called on hidden %s object"
|
"method '%"PRIsVALUE"' called on hidden %s object"
|
||||||
" (%p flags=0x%"PRIxVALUE")",
|
" (%p flags=0x%"PRIxVALUE")",
|
||||||
mname, typestr, (void *)recv, flags);
|
mname, typestr, (void *)recv, flags);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
rb_raise(rb_eNotImpError,
|
rb_raise(rb_eNotImpError,
|
||||||
"method `%"PRIsVALUE"' called on unexpected %s object"
|
"method '%"PRIsVALUE"' called on unexpected %s object"
|
||||||
" (%p flags=0x%"PRIxVALUE")",
|
" (%p flags=0x%"PRIxVALUE")",
|
||||||
mname, typestr, (void *)recv, flags);
|
mname, typestr, (void *)recv, flags);
|
||||||
}
|
}
|
||||||
@ -956,7 +956,7 @@ rb_make_no_method_exception(VALUE exc, VALUE format, VALUE obj,
|
|||||||
VALUE name = argv[0];
|
VALUE name = argv[0];
|
||||||
|
|
||||||
if (!format) {
|
if (!format) {
|
||||||
format = rb_fstring_lit("undefined method `%1$s' for %3$s%4$s");
|
format = rb_fstring_lit("undefined method '%1$s' for %3$s%4$s");
|
||||||
}
|
}
|
||||||
if (exc == rb_eNoMethodError) {
|
if (exc == rb_eNoMethodError) {
|
||||||
VALUE args = rb_ary_new4(argc - 1, argv + 1);
|
VALUE args = rb_ary_new4(argc - 1, argv + 1);
|
||||||
@ -986,17 +986,17 @@ raise_method_missing(rb_execution_context_t *ec, int argc, const VALUE *argv, VA
|
|||||||
stack_check(ec);
|
stack_check(ec);
|
||||||
|
|
||||||
if (last_call_status & MISSING_PRIVATE) {
|
if (last_call_status & MISSING_PRIVATE) {
|
||||||
format = rb_fstring_lit("private method `%1$s' called for %3$s%4$s");
|
format = rb_fstring_lit("private method '%1$s' called for %3$s%4$s");
|
||||||
}
|
}
|
||||||
else if (last_call_status & MISSING_PROTECTED) {
|
else if (last_call_status & MISSING_PROTECTED) {
|
||||||
format = rb_fstring_lit("protected method `%1$s' called for %3$s%4$s");
|
format = rb_fstring_lit("protected method '%1$s' called for %3$s%4$s");
|
||||||
}
|
}
|
||||||
else if (last_call_status & MISSING_VCALL) {
|
else if (last_call_status & MISSING_VCALL) {
|
||||||
format = rb_fstring_lit("undefined local variable or method `%1$s' for %3$s%4$s");
|
format = rb_fstring_lit("undefined local variable or method '%1$s' for %3$s%4$s");
|
||||||
exc = rb_eNameError;
|
exc = rb_eNameError;
|
||||||
}
|
}
|
||||||
else if (last_call_status & MISSING_SUPER) {
|
else if (last_call_status & MISSING_SUPER) {
|
||||||
format = rb_fstring_lit("super: no superclass method `%1$s' for %3$s%4$s");
|
format = rb_fstring_lit("super: no superclass method '%1$s' for %3$s%4$s");
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
12
vm_method.c
12
vm_method.c
@ -941,7 +941,7 @@ rb_method_entry_make(VALUE klass, ID mid, VALUE defined_class, rb_method_visibil
|
|||||||
/* check mid */
|
/* check mid */
|
||||||
if (mid == object_id || mid == id__send__) {
|
if (mid == object_id || mid == id__send__) {
|
||||||
if (type == VM_METHOD_TYPE_ISEQ && search_method(klass, mid, 0)) {
|
if (type == VM_METHOD_TYPE_ISEQ && search_method(klass, mid, 0)) {
|
||||||
rb_warn("redefining `%s' may cause serious problems", rb_id2name(mid));
|
rb_warn("redefining '%s' may cause serious problems", rb_id2name(mid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1549,14 +1549,14 @@ remove_method(VALUE klass, ID mid)
|
|||||||
rb_class_modify_check(klass);
|
rb_class_modify_check(klass);
|
||||||
klass = RCLASS_ORIGIN(klass);
|
klass = RCLASS_ORIGIN(klass);
|
||||||
if (mid == object_id || mid == id__send__ || mid == idInitialize) {
|
if (mid == object_id || mid == id__send__ || mid == idInitialize) {
|
||||||
rb_warn("removing `%s' may cause serious problems", rb_id2name(mid));
|
rb_warn("removing '%s' may cause serious problems", rb_id2name(mid));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!rb_id_table_lookup(RCLASS_M_TBL(klass), mid, &data) ||
|
if (!rb_id_table_lookup(RCLASS_M_TBL(klass), mid, &data) ||
|
||||||
!(me = (rb_method_entry_t *)data) ||
|
!(me = (rb_method_entry_t *)data) ||
|
||||||
(!me->def || me->def->type == VM_METHOD_TYPE_UNDEF) ||
|
(!me->def || me->def->type == VM_METHOD_TYPE_UNDEF) ||
|
||||||
UNDEFINED_REFINED_METHOD_P(me->def)) {
|
UNDEFINED_REFINED_METHOD_P(me->def)) {
|
||||||
rb_name_err_raise("method `%1$s' not defined in %2$s",
|
rb_name_err_raise("method '%1$s' not defined in %2$s",
|
||||||
klass, ID2SYM(mid));
|
klass, ID2SYM(mid));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1606,7 +1606,7 @@ rb_mod_remove_method(int argc, VALUE *argv, VALUE mod)
|
|||||||
VALUE v = argv[i];
|
VALUE v = argv[i];
|
||||||
ID id = rb_check_id(&v);
|
ID id = rb_check_id(&v);
|
||||||
if (!id) {
|
if (!id) {
|
||||||
rb_name_err_raise("method `%1$s' not defined in %2$s",
|
rb_name_err_raise("method '%1$s' not defined in %2$s",
|
||||||
mod, v);
|
mod, v);
|
||||||
}
|
}
|
||||||
remove_method(mod, id);
|
remove_method(mod, id);
|
||||||
@ -1779,7 +1779,7 @@ rb_undef(VALUE klass, ID id)
|
|||||||
}
|
}
|
||||||
rb_class_modify_check(klass);
|
rb_class_modify_check(klass);
|
||||||
if (id == object_id || id == id__send__ || id == idInitialize) {
|
if (id == object_id || id == id__send__ || id == idInitialize) {
|
||||||
rb_warn("undefining `%s' may cause serious problems", rb_id2name(id));
|
rb_warn("undefining '%s' may cause serious problems", rb_id2name(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
me = search_method(klass, id, 0);
|
me = search_method(klass, id, 0);
|
||||||
@ -1839,7 +1839,7 @@ rb_undef(VALUE klass, ID id)
|
|||||||
*
|
*
|
||||||
* In child
|
* In child
|
||||||
* In parent
|
* In parent
|
||||||
* prog.rb:23: undefined method `hello' for #<Child:0x401b3bb4> (NoMethodError)
|
* prog.rb:23: undefined method 'hello' for #<Child:0x401b3bb4> (NoMethodError)
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
@ -1527,7 +1527,7 @@ tracepoint_inspect(rb_execution_context_t *ec, VALUE self)
|
|||||||
VALUE sym = rb_tracearg_method_id(trace_arg);
|
VALUE sym = rb_tracearg_method_id(trace_arg);
|
||||||
if (NIL_P(sym))
|
if (NIL_P(sym))
|
||||||
break;
|
break;
|
||||||
return rb_sprintf("#<TracePoint:%"PRIsVALUE" %"PRIsVALUE":%d in `%"PRIsVALUE"'>",
|
return rb_sprintf("#<TracePoint:%"PRIsVALUE" %"PRIsVALUE":%d in '%"PRIsVALUE"'>",
|
||||||
rb_tracearg_event(trace_arg),
|
rb_tracearg_event(trace_arg),
|
||||||
rb_tracearg_path(trace_arg),
|
rb_tracearg_path(trace_arg),
|
||||||
FIX2INT(rb_tracearg_lineno(trace_arg)),
|
FIX2INT(rb_tracearg_lineno(trace_arg)),
|
||||||
@ -1537,7 +1537,7 @@ tracepoint_inspect(rb_execution_context_t *ec, VALUE self)
|
|||||||
case RUBY_EVENT_C_CALL:
|
case RUBY_EVENT_C_CALL:
|
||||||
case RUBY_EVENT_RETURN:
|
case RUBY_EVENT_RETURN:
|
||||||
case RUBY_EVENT_C_RETURN:
|
case RUBY_EVENT_C_RETURN:
|
||||||
return rb_sprintf("#<TracePoint:%"PRIsVALUE" `%"PRIsVALUE"' %"PRIsVALUE":%d>",
|
return rb_sprintf("#<TracePoint:%"PRIsVALUE" '%"PRIsVALUE"' %"PRIsVALUE":%d>",
|
||||||
rb_tracearg_event(trace_arg),
|
rb_tracearg_event(trace_arg),
|
||||||
rb_tracearg_method_id(trace_arg),
|
rb_tracearg_method_id(trace_arg),
|
||||||
rb_tracearg_path(trace_arg),
|
rb_tracearg_path(trace_arg),
|
||||||
|
@ -263,7 +263,7 @@ rb_default_home_dir(VALUE result)
|
|||||||
{
|
{
|
||||||
WCHAR *dir = rb_w32_home_dir();
|
WCHAR *dir = rb_w32_home_dir();
|
||||||
if (!dir) {
|
if (!dir) {
|
||||||
rb_raise(rb_eArgError, "couldn't find HOME environment -- expanding `~'");
|
rb_raise(rb_eArgError, "couldn't find HOME environment -- expanding '~'");
|
||||||
}
|
}
|
||||||
append_wstr(result, dir, -1,
|
append_wstr(result, dir, -1,
|
||||||
CP_UTF8, rb_utf8_encoding());
|
CP_UTF8, rb_utf8_encoding());
|
||||||
@ -326,7 +326,7 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na
|
|||||||
whome = rb_w32_home_dir();
|
whome = rb_w32_home_dir();
|
||||||
if (whome == NULL) {
|
if (whome == NULL) {
|
||||||
free(wpath);
|
free(wpath);
|
||||||
rb_raise(rb_eArgError, "couldn't find HOME environment -- expanding `~'");
|
rb_raise(rb_eArgError, "couldn't find HOME environment -- expanding '~'");
|
||||||
}
|
}
|
||||||
whome_len = wcslen(whome);
|
whome_len = wcslen(whome);
|
||||||
|
|
||||||
@ -404,7 +404,7 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na
|
|||||||
if (whome == NULL) {
|
if (whome == NULL) {
|
||||||
free(wpath);
|
free(wpath);
|
||||||
free(wdir);
|
free(wdir);
|
||||||
rb_raise(rb_eArgError, "couldn't find HOME environment -- expanding `~'");
|
rb_raise(rb_eArgError, "couldn't find HOME environment -- expanding '~'");
|
||||||
}
|
}
|
||||||
whome_len = wcslen(whome);
|
whome_len = wcslen(whome);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user