зеркало из https://github.com/github/ruby.git
Do not include a backtick in error messages and backtraces
[Feature #16495]
This commit is contained in:
Родитель
926277bf82
Коммит
25d74b9527
12
bignum.c
12
bignum.c
|
@ -4975,7 +4975,7 @@ big2str_generic(VALUE x, int base)
|
|||
invalid_radix(base);
|
||||
|
||||
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;
|
||||
|
@ -5100,7 +5100,7 @@ rb_big2str1(VALUE x, int base)
|
|||
invalid_radix(base);
|
||||
|
||||
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)) {
|
||||
|
@ -5136,7 +5136,7 @@ big2ulong(VALUE x, const char *type)
|
|||
if (len == 0)
|
||||
return 0;
|
||||
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);
|
||||
#if SIZEOF_LONG <= SIZEOF_BDIGIT
|
||||
|
@ -5179,7 +5179,7 @@ rb_big2long(VALUE x)
|
|||
if (num <= 1+(unsigned long)(-(LONG_MIN+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
|
||||
|
@ -5197,7 +5197,7 @@ big2ull(VALUE x, const char *type)
|
|||
if (len == 0)
|
||||
return 0;
|
||||
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
|
||||
num = (unsigned LONG_LONG)ds[0];
|
||||
#else
|
||||
|
@ -5238,7 +5238,7 @@ rb_big2ll(VALUE x)
|
|||
if (num <= 1+(unsigned LONG_LONG)(-(LLONG_MIN+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 */
|
||||
|
|
|
@ -370,7 +370,7 @@ assert_equal %q{}, %q{
|
|||
}
|
||||
|
||||
##
|
||||
assert_match /undefined method `foo\'/, %q{#`
|
||||
assert_match /undefined method 'foo\'/, %q{#`
|
||||
STDERR.reopen(STDOUT)
|
||||
class C
|
||||
def inspect
|
||||
|
|
|
@ -534,9 +534,9 @@ end
|
|||
assert_syntax_error "unterminated string meets end of file", '().."', '[ruby-dev:29732]'
|
||||
assert_equal %q{[]}, %q{$&;[]}, '[ruby-dev:31068]'
|
||||
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 "`$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 "'@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{0..$00=1}
|
||||
assert_equal %q{0}, %q{[*0];0}, '[ruby-dev:31102]'
|
||||
assert_syntax_error "unexpected ')'", %q{v0,(*,v1,) = 0}, '[ruby-dev:31104]'
|
||||
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;
|
||||
}
|
||||
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);
|
||||
rb_vm_add_root_module(klass);
|
||||
|
@ -1030,7 +1030,7 @@ rb_define_class_id_under(VALUE outer, ID id, VALUE super)
|
|||
return klass;
|
||||
}
|
||||
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));
|
||||
}
|
||||
klass = rb_define_class_id(id, super);
|
||||
|
@ -1706,7 +1706,7 @@ VALUE
|
|||
rb_class_attached_object(VALUE klass)
|
||||
{
|
||||
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);
|
||||
|
|
|
@ -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");
|
||||
}
|
||||
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; \
|
||||
} \
|
||||
if (len > 0) { \
|
||||
fprintf(stderr, "ignored "name" option: `%.*s'\n", len, str); \
|
||||
fprintf(stderr, "ignored "name" option: '%.*s'\n", len, str); \
|
||||
} \
|
||||
} while (0)
|
||||
#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);
|
||||
ec->errinfo = mesg;
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
else {
|
||||
e = rb_sprintf("Exception `%"PRIsVALUE"' - %"PRIsVALUE"\n",
|
||||
e = rb_sprintf("Exception '%"PRIsVALUE"' - %"PRIsVALUE"\n",
|
||||
rb_obj_class(mesg), e);
|
||||
}
|
||||
warn_print_str(e);
|
||||
|
|
|
@ -47,7 +47,7 @@ error_pos_str(void)
|
|||
return rb_sprintf("%"PRIsVALUE": ", sourcefile);
|
||||
}
|
||||
else if ((caller_name = rb_frame_callee()) != 0) {
|
||||
return rb_sprintf("%"PRIsVALUE":%d:in `%"PRIsVALUE"': ",
|
||||
return rb_sprintf("%"PRIsVALUE":%d:in '%"PRIsVALUE"': ",
|
||||
sourcefile, sourceline,
|
||||
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);
|
||||
}
|
||||
|
||||
#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) ( \
|
||||
is_mod ? \
|
||||
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);
|
||||
}
|
||||
|
||||
#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) ( \
|
||||
is_mod ? \
|
||||
inaccessible_mesg_for(v, "module") : \
|
||||
|
|
|
@ -6,7 +6,7 @@ bug_struct_get(VALUE obj, VALUE name)
|
|||
ID id = rb_check_id(&name);
|
||||
|
||||
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);
|
||||
}
|
||||
|
|
6
file.c
6
file.c
|
@ -3666,7 +3666,7 @@ rb_default_home_dir(VALUE result)
|
|||
* lookup by getuid() has a chance of succeeding.
|
||||
*/
|
||||
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) */
|
||||
|
||||
|
@ -3674,7 +3674,7 @@ rb_default_home_dir(VALUE result)
|
|||
if (NIL_P(pw_dir)) {
|
||||
pw_dir = rb_getpwdiruid();
|
||||
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 */
|
||||
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);
|
||||
}
|
||||
|
|
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);
|
||||
if (!NIL_P(val)) {
|
||||
rb_warn_deprecated("`%s'", NULL, rb_id2name(id));
|
||||
rb_warn_deprecated("'%s'", NULL, rb_id2name(id));
|
||||
}
|
||||
*var = val;
|
||||
}
|
||||
|
|
|
@ -186,7 +186,7 @@ class Delegator < BasicObject
|
|||
# method calls are being delegated to.
|
||||
#
|
||||
def __getobj__
|
||||
__raise__ ::NotImplementedError, "need to define `__getobj__'"
|
||||
__raise__ ::NotImplementedError, "need to define '__getobj__'"
|
||||
end
|
||||
|
||||
#
|
||||
|
@ -194,7 +194,7 @@ class Delegator < BasicObject
|
|||
# to _obj_.
|
||||
#
|
||||
def __setobj__(obj)
|
||||
__raise__ ::NotImplementedError, "need to define `__setobj__'"
|
||||
__raise__ ::NotImplementedError, "need to define '__setobj__'"
|
||||
end
|
||||
|
||||
#
|
||||
|
|
|
@ -1651,7 +1651,7 @@ module FileUtils
|
|||
when "a"
|
||||
mask | 07777
|
||||
else
|
||||
raise ArgumentError, "invalid `who' symbol in file mode: #{chr}"
|
||||
raise ArgumentError, "invalid 'who' symbol in file mode: #{chr}"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -1705,7 +1705,7 @@ module FileUtils
|
|||
copy_mask = user_mask(chr)
|
||||
(current_mode & copy_mask) / (copy_mask & 0111) * (user_mask & 0111)
|
||||
else
|
||||
raise ArgumentError, "invalid `perm' symbol in file mode: #{chr}"
|
||||
raise ArgumentError, "invalid 'perm' symbol in file mode: #{chr}"
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1235,7 +1235,7 @@ module IRB
|
|||
lines.map{ |l| l + "\n" }.join
|
||||
}
|
||||
# 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 'Maybe IRB bug!' if irb_bug
|
||||
rescue Exception => handler_exc
|
||||
|
|
|
@ -849,7 +849,7 @@ class OptionParser
|
|||
def accept(t, pat = /.*/m, &block)
|
||||
if pat
|
||||
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
|
||||
pat = t if t.respond_to?(:match)
|
||||
end
|
||||
|
|
|
@ -376,7 +376,7 @@ class OpenStruct
|
|||
end
|
||||
@table.delete(sym) do
|
||||
return yield if block
|
||||
raise! NameError.new("no field `#{sym}' in #{self}", sym)
|
||||
raise! NameError.new("no field '#{sym}' in #{self}", sym)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -437,7 +437,7 @@ class PStore
|
|||
in_transaction
|
||||
unless @table.key? key
|
||||
if default == PStore::Error
|
||||
raise PStore::Error, format("undefined key `%s'", key)
|
||||
raise PStore::Error, format("undefined key '%s'", key)
|
||||
else
|
||||
return default
|
||||
end
|
||||
|
|
|
@ -62,7 +62,7 @@ class Reline::History < Array
|
|||
private def check_index(index)
|
||||
index += size if index < 0
|
||||
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
|
||||
# If history_size is negative, history size is unlimited.
|
||||
if @config.history_size.positive?
|
||||
|
|
|
@ -455,7 +455,7 @@ class Time
|
|||
#
|
||||
def strptime(date, format, now=self.now)
|
||||
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 sec_fraction = d[:sec_fraction]
|
||||
usec = sec_fraction * 1000000
|
||||
|
|
|
@ -158,7 +158,7 @@ class Dir
|
|||
n ||= 0
|
||||
n += 1
|
||||
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
|
||||
path
|
||||
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 (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));
|
||||
}
|
||||
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));
|
||||
}
|
||||
return ST_CONTINUE;
|
||||
|
@ -1796,7 +1796,7 @@ append_extmod(VALUE obj, VALUE extmod)
|
|||
#define prohibit_ivar(type, str) do { \
|
||||
if (!ivp || !*ivp) break; \
|
||||
rb_raise(rb_eTypeError, \
|
||||
"can't override instance variable of "type" `%"PRIsVALUE"'", \
|
||||
"can't override instance variable of "type" '%"PRIsVALUE"'", \
|
||||
(str)); \
|
||||
} 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;
|
||||
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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);
|
||||
if (!rb_obj_respond_to(v, s_load_data, TRUE)) {
|
||||
rb_raise(rb_eTypeError,
|
||||
"class %"PRIsVALUE" needs to have instance method `_load_data'",
|
||||
"class %"PRIsVALUE" needs to have instance method '_load_data'",
|
||||
name);
|
||||
}
|
||||
r = r_object0(arg, partial, 0, extmod);
|
||||
|
|
14
numeric.c
14
numeric.c
|
@ -3213,7 +3213,7 @@ rb_num2ulong(VALUE val)
|
|||
void
|
||||
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");
|
||||
}
|
||||
|
||||
|
@ -3232,12 +3232,12 @@ check_uint(unsigned long num, int sign)
|
|||
if (sign) {
|
||||
/* minus */
|
||||
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 {
|
||||
/* plus */
|
||||
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
|
||||
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");
|
||||
}
|
||||
|
||||
|
@ -3330,12 +3330,12 @@ check_ushort(unsigned long num, int sign)
|
|||
if (sign) {
|
||||
/* minus */
|
||||
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 {
|
||||
/* plus */
|
||||
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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
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_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_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
|
||||
|
||||
/*! \private */
|
||||
|
|
182
parse.y
182
parse.y
|
@ -2034,7 +2034,7 @@ clear_block_exit(struct parser_params *p, bool error)
|
|||
|
||||
#define WARN_EOL(tok) \
|
||||
(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)
|
||||
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>
|
||||
keyword_class "`class'"
|
||||
keyword_module "`module'"
|
||||
keyword_def "`def'"
|
||||
keyword_undef "`undef'"
|
||||
keyword_begin "`begin'"
|
||||
keyword_rescue "`rescue'"
|
||||
keyword_ensure "`ensure'"
|
||||
keyword_end "`end'"
|
||||
keyword_if "`if'"
|
||||
keyword_unless "`unless'"
|
||||
keyword_then "`then'"
|
||||
keyword_elsif "`elsif'"
|
||||
keyword_else "`else'"
|
||||
keyword_case "`case'"
|
||||
keyword_when "`when'"
|
||||
keyword_while "`while'"
|
||||
keyword_until "`until'"
|
||||
keyword_for "`for'"
|
||||
keyword_break "`break'"
|
||||
keyword_next "`next'"
|
||||
keyword_redo "`redo'"
|
||||
keyword_retry "`retry'"
|
||||
keyword_in "`in'"
|
||||
keyword_do "`do'"
|
||||
keyword_do_cond "`do' for condition"
|
||||
keyword_do_block "`do' for block"
|
||||
keyword_do_LAMBDA "`do' for lambda"
|
||||
keyword_return "`return'"
|
||||
keyword_yield "`yield'"
|
||||
keyword_super "`super'"
|
||||
keyword_self "`self'"
|
||||
keyword_nil "`nil'"
|
||||
keyword_true "`true'"
|
||||
keyword_false "`false'"
|
||||
keyword_and "`and'"
|
||||
keyword_or "`or'"
|
||||
keyword_not "`not'"
|
||||
modifier_if "`if' modifier"
|
||||
modifier_unless "`unless' modifier"
|
||||
modifier_while "`while' modifier"
|
||||
modifier_until "`until' modifier"
|
||||
modifier_rescue "`rescue' modifier"
|
||||
keyword_alias "`alias'"
|
||||
keyword_defined "`defined?'"
|
||||
keyword_BEGIN "`BEGIN'"
|
||||
keyword_END "`END'"
|
||||
keyword__LINE__ "`__LINE__'"
|
||||
keyword__FILE__ "`__FILE__'"
|
||||
keyword__ENCODING__ "`__ENCODING__'"
|
||||
keyword_class "'class'"
|
||||
keyword_module "'module'"
|
||||
keyword_def "'def'"
|
||||
keyword_undef "'undef'"
|
||||
keyword_begin "'begin'"
|
||||
keyword_rescue "'rescue'"
|
||||
keyword_ensure "'ensure'"
|
||||
keyword_end "'end'"
|
||||
keyword_if "'if'"
|
||||
keyword_unless "'unless'"
|
||||
keyword_then "'then'"
|
||||
keyword_elsif "'elsif'"
|
||||
keyword_else "'else'"
|
||||
keyword_case "'case'"
|
||||
keyword_when "'when'"
|
||||
keyword_while "'while'"
|
||||
keyword_until "'until'"
|
||||
keyword_for "'for'"
|
||||
keyword_break "'break'"
|
||||
keyword_next "'next'"
|
||||
keyword_redo "'redo'"
|
||||
keyword_retry "'retry'"
|
||||
keyword_in "'in'"
|
||||
keyword_do "'do'"
|
||||
keyword_do_cond "'do' for condition"
|
||||
keyword_do_block "'do' for block"
|
||||
keyword_do_LAMBDA "'do' for lambda"
|
||||
keyword_return "'return'"
|
||||
keyword_yield "'yield'"
|
||||
keyword_super "'super'"
|
||||
keyword_self "'self'"
|
||||
keyword_nil "'nil'"
|
||||
keyword_true "'true'"
|
||||
keyword_false "'false'"
|
||||
keyword_and "'and'"
|
||||
keyword_or "'or'"
|
||||
keyword_not "'not'"
|
||||
modifier_if "'if' modifier"
|
||||
modifier_unless "'unless' modifier"
|
||||
modifier_while "'while' modifier"
|
||||
modifier_until "'until' modifier"
|
||||
modifier_rescue "'rescue' modifier"
|
||||
keyword_alias "'alias'"
|
||||
keyword_defined "'defined?'"
|
||||
keyword_BEGIN "'BEGIN'"
|
||||
keyword_END "'END'"
|
||||
keyword__LINE__ "'__LINE__'"
|
||||
keyword__FILE__ "'__FILE__'"
|
||||
keyword__ENCODING__ "'__ENCODING__'"
|
||||
|
||||
%token <id> tIDENTIFIER "local variable or method"
|
||||
%token <id> tFID "method"
|
||||
|
@ -9915,10 +9915,10 @@ arg_ambiguous(struct parser_params *p, char c)
|
|||
{
|
||||
#ifndef RIPPER
|
||||
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 {
|
||||
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
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -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) {
|
||||
if (*s == ' ' || *s == '\t') continue;
|
||||
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;
|
||||
}
|
||||
|
||||
|
@ -10388,7 +10388,7 @@ parser_prepare(struct parser_params *p)
|
|||
|
||||
#ifndef RIPPER
|
||||
#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""))
|
||||
#else
|
||||
#define ambiguous_operator(tok, op, syn) \
|
||||
|
@ -10619,7 +10619,7 @@ parse_numeric(struct parser_params *p, int c)
|
|||
trailing_uc:
|
||||
literal_flush(p, p->lex.pcur - 1);
|
||||
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);
|
||||
}
|
||||
tokfix(p);
|
||||
|
@ -10685,8 +10685,8 @@ parse_qmark(struct parser_params *p, int space_seen)
|
|||
if (n < 0) return -1;
|
||||
ptr += n;
|
||||
} 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" \
|
||||
" a conditional operator, put a space after `?'",
|
||||
rb_warn2("'?' just followed by '%.*s' is interpreted as" \
|
||||
" a conditional operator, put a space after '?'",
|
||||
WARN_I((int)(ptr - start)), WARN_S_L(start, (ptr - start)));
|
||||
}
|
||||
goto ternary;
|
||||
|
@ -10849,7 +10849,7 @@ parse_numvar(struct parser_params *p)
|
|||
|
||||
if (overflow || n > nth_ref_max) {
|
||||
/* 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 */
|
||||
}
|
||||
else {
|
||||
|
@ -10945,11 +10945,11 @@ parse_gvar(struct parser_params *p, const enum lex_state_e last_state)
|
|||
if (!parser_is_identchar(p)) {
|
||||
YYLTYPE loc = RUBY_INIT_YYLLOC();
|
||||
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 {
|
||||
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);
|
||||
set_yylval_noname();
|
||||
|
@ -10966,7 +10966,7 @@ parse_gvar(struct parser_params *p, const enum lex_state_e last_state)
|
|||
tokenize_ident(p);
|
||||
}
|
||||
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();
|
||||
}
|
||||
return tGVAR;
|
||||
|
@ -11017,10 +11017,10 @@ parse_atmark(struct parser_params *p, const enum lex_state_e last_state)
|
|||
pushback(p, c);
|
||||
RUBY_SET_YYLLOC(loc);
|
||||
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 {
|
||||
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);
|
||||
set_yylval_noname();
|
||||
|
@ -11031,10 +11031,10 @@ parse_atmark(struct parser_params *p, const enum lex_state_e last_state)
|
|||
pushback(p, c);
|
||||
RUBY_SET_YYLLOC(loc);
|
||||
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 {
|
||||
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);
|
||||
set_yylval_noname();
|
||||
|
@ -11333,7 +11333,7 @@ parser_yylex(struct parser_params *p)
|
|||
}
|
||||
pushback(p, c);
|
||||
if (IS_SPCARG(c)) {
|
||||
rb_warning0("`**' interpreted as argument prefix");
|
||||
rb_warning0("'**' interpreted as argument prefix");
|
||||
c = tDSTAR;
|
||||
}
|
||||
else if (IS_BEG()) {
|
||||
|
@ -11351,7 +11351,7 @@ parser_yylex(struct parser_params *p)
|
|||
}
|
||||
pushback(p, c);
|
||||
if (IS_SPCARG(c)) {
|
||||
rb_warning0("`*' interpreted as argument prefix");
|
||||
rb_warning0("'*' interpreted as argument prefix");
|
||||
c = tSTAR;
|
||||
}
|
||||
else if (IS_BEG()) {
|
||||
|
@ -11541,7 +11541,7 @@ parser_yylex(struct parser_params *p)
|
|||
(c = peekc_n(p, 1)) == -1 ||
|
||||
!(c == '\'' || c == '"' ||
|
||||
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;
|
||||
}
|
||||
|
@ -11892,7 +11892,7 @@ parser_yylex(struct parser_params *p)
|
|||
|
||||
default:
|
||||
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);
|
||||
goto retry;
|
||||
}
|
||||
|
@ -13584,7 +13584,7 @@ it_used_p(struct parser_params *p)
|
|||
{
|
||||
NODE *it = p->lvtbl->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",
|
||||
p->ruby_sourcefile, nd_line(it));
|
||||
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 {
|
||||
VALUE line = rb_hash_lookup(p->case_labels, lit);
|
||||
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));
|
||||
return;
|
||||
}
|
||||
|
@ -15013,7 +15013,7 @@ assign_in_cond(struct parser_params *p, NODE *node)
|
|||
if (!get_nd_value(p, node)) return 1;
|
||||
if (is_static_content(get_nd_value(p, node))) {
|
||||
/* 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;
|
||||
}
|
||||
|
@ -17060,31 +17060,30 @@ rb_yytnamerr(struct parser_params *p, char *yyres, const char *yystr)
|
|||
|
||||
while (*++yyp) {
|
||||
switch (*yyp) {
|
||||
case '`':
|
||||
case '\'':
|
||||
if (!bquote) {
|
||||
bquote = count_char(yyp+1, '`') + 1;
|
||||
bquote = count_char(yyp+1, '\'') + 1;
|
||||
if (yyres) memcpy(&yyres[yyn], yyp, bquote);
|
||||
yyn += bquote;
|
||||
yyp += bquote - 1;
|
||||
break;
|
||||
}
|
||||
goto default_char;
|
||||
|
||||
case '\'':
|
||||
if (bquote && count_char(yyp+1, '\'') + 1 == bquote) {
|
||||
if (yyres) memcpy(yyres + yyn, yyp, bquote);
|
||||
yyn += bquote;
|
||||
yyp += bquote - 1;
|
||||
bquote = 0;
|
||||
break;
|
||||
else {
|
||||
if (bquote && count_char(yyp+1, '\'') + 1 == bquote) {
|
||||
if (yyres) memcpy(yyres + yyn, yyp, bquote);
|
||||
yyn += bquote;
|
||||
yyp += bquote - 1;
|
||||
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 ',':
|
||||
goto do_not_strip_quotes;
|
||||
|
@ -17093,7 +17092,6 @@ rb_yytnamerr(struct parser_params *p, char *yyres, const char *yystr)
|
|||
if (*++yyp != '\\')
|
||||
goto do_not_strip_quotes;
|
||||
/* Fall through. */
|
||||
default_char:
|
||||
default:
|
||||
if (yyres)
|
||||
yyres[yyn] = *yyp;
|
||||
|
|
10
proc.c
10
proc.c
|
@ -457,13 +457,13 @@ check_local_id(VALUE bindval, volatile VALUE *pname)
|
|||
|
||||
if (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));
|
||||
}
|
||||
}
|
||||
else {
|
||||
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);
|
||||
}
|
||||
return 0;
|
||||
|
@ -536,7 +536,7 @@ bind_local_variable_get(VALUE bindval, VALUE sym)
|
|||
|
||||
sym = ID2SYM(lid);
|
||||
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);
|
||||
UNREACHABLE_RETURN(Qundef);
|
||||
}
|
||||
|
@ -1936,7 +1936,7 @@ method_owner(VALUE obj)
|
|||
void
|
||||
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 s = Qundef;
|
||||
|
||||
|
@ -2091,7 +2091,7 @@ rb_obj_singleton_method(VALUE obj, VALUE vid)
|
|||
}
|
||||
|
||||
/* 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);
|
||||
UNREACHABLE_RETURN(Qundef);
|
||||
}
|
||||
|
|
2
range.c
2
range.c
|
@ -78,7 +78,7 @@ range_modify(VALUE range)
|
|||
rb_check_frozen(range);
|
||||
/* Ranges are immutable, so that they should be initialized only once. */
|
||||
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 {
|
||||
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 (matched == 1) goto found;
|
||||
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) \
|
||||
if (FEATURE_BIT(bit) & set) { \
|
||||
rb_str_cat_cstr(mesg, #bit); \
|
||||
|
@ -1043,7 +1043,7 @@ feature_option(const char *str, int len, void *arg, const unsigned int enable)
|
|||
#else
|
||||
(void)set;
|
||||
#endif
|
||||
rb_warn("unknown argument for --%s: `%.*s'",
|
||||
rb_warn("unknown argument for --%s: '%.*s'",
|
||||
enable ? "enable" : "disable", len, str);
|
||||
rb_warn("features are [%.*s].", (int)strlen(list), list);
|
||||
return;
|
||||
|
@ -1082,7 +1082,7 @@ debug_option(const char *str, int len, void *arg)
|
|||
#ifdef RUBY_DEVEL
|
||||
if (ruby_patchlevel < 0 && ruby_env_debug_option(str, len, 0)) return;
|
||||
#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);
|
||||
}
|
||||
|
||||
|
@ -1105,14 +1105,14 @@ dump_additional_option(const char *str, int len, unsigned int bits, const char *
|
|||
w = memtermspn(str, additional_opt_sep, len);
|
||||
#define SET_ADDITIONAL(bit) if (NAME_MATCH_P(#bit, str, w)) { \
|
||||
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); \
|
||||
continue; \
|
||||
}
|
||||
if (dump_error_tolerant_bits & bits) {
|
||||
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;
|
||||
}
|
||||
|
@ -1130,7 +1130,7 @@ dump_option(const char *str, int len, void *arg)
|
|||
return; \
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -1176,7 +1176,7 @@ setup_yjit_options(const char *s)
|
|||
|
||||
rb_raise(
|
||||
rb_eRuntimeError,
|
||||
"invalid YJIT option `%s' (--help will show valid yjit options)",
|
||||
"invalid YJIT option '%s' (--help will show valid yjit options)",
|
||||
s
|
||||
);
|
||||
}
|
||||
|
@ -1214,7 +1214,7 @@ proc_W_option(ruby_cmdline_options_t *opt, const char *s, int *warning)
|
|||
bits = 1U << RB_WARN_CATEGORY_PERFORMANCE;
|
||||
}
|
||||
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);
|
||||
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);
|
||||
prefix = signame_prefix_len;
|
||||
}
|
||||
rb_raise(rb_eArgError, "unsupported signal `%.*s%"PRIsVALUE"'",
|
||||
rb_raise(rb_eArgError, "unsupported signal '%.*s%"PRIsVALUE"'",
|
||||
prefix, signame_prefix, vsig);
|
||||
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));
|
||||
}
|
||||
if (!NIL_P(val)) {
|
||||
rb_warn_deprecated("`$;'", NULL);
|
||||
rb_warn_deprecated("'$;'", NULL);
|
||||
}
|
||||
*var = val;
|
||||
}
|
||||
|
|
2
struct.c
2
struct.c
|
@ -236,7 +236,7 @@ rb_struct_getmember(VALUE obj, ID id)
|
|||
if (i != -1) {
|
||||
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);
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ module Bug::Marshal
|
|||
assert_equal("hello", v.normal)
|
||||
assert_equal("world", v.internal)
|
||||
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)
|
||||
}
|
||||
v = assert_nothing_raised {break ::Marshal.load(dump)}
|
||||
|
|
|
@ -13,8 +13,8 @@ end
|
|||
SRC
|
||||
out = [
|
||||
"start() function is unimplemented on this machine",
|
||||
"-:2:in `start'",
|
||||
"-:2:in `<main>'",
|
||||
"-:2:in 'start'",
|
||||
"-:2:in '<main>'",
|
||||
]
|
||||
assert_in_out_err(%w"-r-test-/bug_3571", src, [], out, bug3571)
|
||||
end
|
||||
|
|
|
@ -49,7 +49,7 @@ class NameErrorExtensionTest < Test::Unit::TestCase
|
|||
|
||||
get_message(error)
|
||||
|
||||
assert_match(/^undefined method `sizee' for /,
|
||||
assert_match(/^undefined method [`']sizee' for /,
|
||||
Marshal.load(Marshal.dump(error)).original_message)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -23,17 +23,31 @@ class ErrorHighlightTest < Test::Unit::TestCase
|
|||
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)
|
||||
def assert_error_message(klass, expected_msg, &blk)
|
||||
omit unless klass < ErrorHighlight::CoreExt
|
||||
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
|
||||
else
|
||||
def assert_error_message(klass, expected_msg, &blk)
|
||||
omit unless klass < ErrorHighlight::CoreExt
|
||||
err = assert_raise(klass, &blk)
|
||||
assert_equal(expected_msg.chomp, err.message)
|
||||
assert_equal(preprocess(expected_msg).chomp, err.message)
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ module TestIRB
|
|||
irb.eval_input
|
||||
end
|
||||
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/,
|
||||
:*, /0$/,
|
||||
:*, /0$/,
|
||||
|
@ -89,8 +89,8 @@ module TestIRB
|
|||
end
|
||||
assert_empty err
|
||||
assert_pattern_list([
|
||||
:*, /\(irb\):1:in `<main>': Foo \(RuntimeError\)\n/,
|
||||
:*, /\(irb\):2:in `<main>': Bar \(RuntimeError\)\n/,
|
||||
:*, /\(irb\):1:in '<main>': Foo \(RuntimeError\)\n/,
|
||||
:*, /\(irb\):2:in '<main>': Bar \(RuntimeError\)\n/,
|
||||
:*, /#<RuntimeError: Bar>\n/,
|
||||
], out)
|
||||
end
|
||||
|
@ -130,9 +130,9 @@ module TestIRB
|
|||
[:marshal, "123", Marshal.dump(123)],
|
||||
],
|
||||
failed: [
|
||||
[false, "BasicObject.new", /#<NoMethodError: undefined method `to_s' for/],
|
||||
[:p, "class Foo; undef inspect ;end; Foo.new", /#<NoMethodError: undefined method `inspect' for/],
|
||||
[:yaml, "BasicObject.new", /#<NoMethodError: undefined method `inspect' for/],
|
||||
[false, "BasicObject.new", /#<NoMethodError: undefined method 'to_s' for/],
|
||||
[:p, "class Foo; undef inspect ;end; Foo.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:/]
|
||||
]
|
||||
}.each do |scenario, cases|
|
||||
|
@ -210,7 +210,7 @@ module TestIRB
|
|||
end
|
||||
assert_empty err
|
||||
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
|
||||
$VERBOSE = verbose
|
||||
end
|
||||
|
@ -503,15 +503,15 @@ module TestIRB
|
|||
if RUBY_VERSION < '3.0.0' && STDOUT.tty?
|
||||
expected = [
|
||||
:*, /Traceback \(most recent call last\):\n/,
|
||||
:*, /\t 2: from \(irb\):1:in `<main>'\n/,
|
||||
:*, /\t 1: from \(irb\):1:in `hoge'\n/,
|
||||
:*, /\(irb\):1:in `fuga': unhandled exception\n/,
|
||||
:*, /\t 2: from \(irb\):1:in '<main>'\n/,
|
||||
:*, /\t 1: from \(irb\):1:in 'hoge'\n/,
|
||||
:*, /\(irb\):1:in 'fuga': unhandled exception\n/,
|
||||
]
|
||||
else
|
||||
expected = [
|
||||
:*, /\(irb\):1:in `fuga': unhandled exception\n/,
|
||||
:*, /\tfrom \(irb\):1:in `hoge'\n/,
|
||||
:*, /\tfrom \(irb\):1:in `<main>'\n/,
|
||||
:*, /\(irb\):1:in 'fuga': unhandled exception\n/,
|
||||
:*, /\tfrom \(irb\):1:in 'hoge'\n/,
|
||||
:*, /\tfrom \(irb\):1:in '<main>'\n/,
|
||||
:*
|
||||
]
|
||||
end
|
||||
|
@ -533,15 +533,15 @@ module TestIRB
|
|||
if RUBY_VERSION < '3.0.0' && STDOUT.tty?
|
||||
expected = [
|
||||
:*, /Traceback \(most recent call last\):\n/,
|
||||
:*, /\t 2: from \(irb\):1:in `<main>'\n/,
|
||||
:*, /\t 1: from \(irb\):1:in `hoge'\n/,
|
||||
:*, /\(irb\):1:in `fuga': A\\xF3B \(RuntimeError\)\n/,
|
||||
:*, /\t 2: from \(irb\):1:in '<main>'\n/,
|
||||
:*, /\t 1: from \(irb\):1:in 'hoge'\n/,
|
||||
:*, /\(irb\):1:in 'fuga': A\\xF3B \(RuntimeError\)\n/,
|
||||
]
|
||||
else
|
||||
expected = [
|
||||
:*, /\(irb\):1:in `fuga': A\\xF3B \(RuntimeError\)\n/,
|
||||
:*, /\tfrom \(irb\):1:in `hoge'\n/,
|
||||
:*, /\tfrom \(irb\):1:in `<main>'\n/,
|
||||
:*, /\(irb\):1:in 'fuga': A\\xF3B \(RuntimeError\)\n/,
|
||||
:*, /\tfrom \(irb\):1:in 'hoge'\n/,
|
||||
:*, /\tfrom \(irb\):1:in '<main>'\n/,
|
||||
:*
|
||||
]
|
||||
end
|
||||
|
@ -571,43 +571,43 @@ module TestIRB
|
|||
expected = [
|
||||
:*, /Traceback \(most recent call last\):\n/,
|
||||
:*, /\t... \d+ levels...\n/,
|
||||
:*, /\t16: from \(irb\):1:in `a4'\n/,
|
||||
:*, /\t15: from \(irb\):1:in `a5'\n/,
|
||||
:*, /\t14: from \(irb\):1:in `a6'\n/,
|
||||
:*, /\t13: from \(irb\):1:in `a7'\n/,
|
||||
:*, /\t12: from \(irb\):1:in `a8'\n/,
|
||||
:*, /\t11: from \(irb\):1:in `a9'\n/,
|
||||
:*, /\t10: from \(irb\):1:in `a10'\n/,
|
||||
:*, /\t 9: from \(irb\):1:in `a11'\n/,
|
||||
:*, /\t 8: from \(irb\):1:in `a12'\n/,
|
||||
:*, /\t 7: from \(irb\):1:in `a13'\n/,
|
||||
:*, /\t 6: from \(irb\):1:in `a14'\n/,
|
||||
:*, /\t 5: from \(irb\):1:in `a15'\n/,
|
||||
:*, /\t 4: from \(irb\):1:in `a16'\n/,
|
||||
:*, /\t 3: from \(irb\):1:in `a17'\n/,
|
||||
:*, /\t 2: from \(irb\):1:in `a18'\n/,
|
||||
:*, /\t 1: from \(irb\):1:in `a19'\n/,
|
||||
:*, /\(irb\):1:in `a20': unhandled exception\n/,
|
||||
:*, /\t16: from \(irb\):1:in 'a4'\n/,
|
||||
:*, /\t15: from \(irb\):1:in 'a5'\n/,
|
||||
:*, /\t14: from \(irb\):1:in 'a6'\n/,
|
||||
:*, /\t13: from \(irb\):1:in 'a7'\n/,
|
||||
:*, /\t12: from \(irb\):1:in 'a8'\n/,
|
||||
:*, /\t11: from \(irb\):1:in 'a9'\n/,
|
||||
:*, /\t10: from \(irb\):1:in 'a10'\n/,
|
||||
:*, /\t 9: from \(irb\):1:in 'a11'\n/,
|
||||
:*, /\t 8: from \(irb\):1:in 'a12'\n/,
|
||||
:*, /\t 7: from \(irb\):1:in 'a13'\n/,
|
||||
:*, /\t 6: from \(irb\):1:in 'a14'\n/,
|
||||
:*, /\t 5: from \(irb\):1:in 'a15'\n/,
|
||||
:*, /\t 4: from \(irb\):1:in 'a16'\n/,
|
||||
:*, /\t 3: from \(irb\):1:in 'a17'\n/,
|
||||
:*, /\t 2: from \(irb\):1:in 'a18'\n/,
|
||||
:*, /\t 1: from \(irb\):1:in 'a19'\n/,
|
||||
:*, /\(irb\):1:in 'a20': unhandled exception\n/,
|
||||
]
|
||||
else
|
||||
expected = [
|
||||
:*, /\(irb\):1:in `a20': unhandled exception\n/,
|
||||
:*, /\tfrom \(irb\):1:in `a19'\n/,
|
||||
:*, /\tfrom \(irb\):1:in `a18'\n/,
|
||||
:*, /\tfrom \(irb\):1:in `a17'\n/,
|
||||
:*, /\tfrom \(irb\):1:in `a16'\n/,
|
||||
:*, /\tfrom \(irb\):1:in `a15'\n/,
|
||||
:*, /\tfrom \(irb\):1:in `a14'\n/,
|
||||
:*, /\tfrom \(irb\):1:in `a13'\n/,
|
||||
:*, /\tfrom \(irb\):1:in `a12'\n/,
|
||||
:*, /\tfrom \(irb\):1:in `a11'\n/,
|
||||
:*, /\tfrom \(irb\):1:in `a10'\n/,
|
||||
:*, /\tfrom \(irb\):1:in `a9'\n/,
|
||||
:*, /\tfrom \(irb\):1:in `a8'\n/,
|
||||
:*, /\tfrom \(irb\):1:in `a7'\n/,
|
||||
:*, /\tfrom \(irb\):1:in `a6'\n/,
|
||||
:*, /\tfrom \(irb\):1:in `a5'\n/,
|
||||
:*, /\tfrom \(irb\):1:in `a4'\n/,
|
||||
:*, /\(irb\):1:in 'a20': unhandled exception\n/,
|
||||
:*, /\tfrom \(irb\):1:in 'a19'\n/,
|
||||
:*, /\tfrom \(irb\):1:in 'a18'\n/,
|
||||
:*, /\tfrom \(irb\):1:in 'a17'\n/,
|
||||
:*, /\tfrom \(irb\):1:in 'a16'\n/,
|
||||
:*, /\tfrom \(irb\):1:in 'a15'\n/,
|
||||
:*, /\tfrom \(irb\):1:in 'a14'\n/,
|
||||
:*, /\tfrom \(irb\):1:in 'a13'\n/,
|
||||
:*, /\tfrom \(irb\):1:in 'a12'\n/,
|
||||
:*, /\tfrom \(irb\):1:in 'a11'\n/,
|
||||
:*, /\tfrom \(irb\):1:in 'a10'\n/,
|
||||
:*, /\tfrom \(irb\):1:in 'a9'\n/,
|
||||
:*, /\tfrom \(irb\):1:in 'a8'\n/,
|
||||
:*, /\tfrom \(irb\):1:in 'a7'\n/,
|
||||
:*, /\tfrom \(irb\):1:in 'a6'\n/,
|
||||
:*, /\tfrom \(irb\):1:in 'a5'\n/,
|
||||
:*, /\tfrom \(irb\):1:in 'a4'\n/,
|
||||
:*, /\t... \d+ levels...\n/,
|
||||
]
|
||||
end
|
||||
|
|
|
@ -37,7 +37,7 @@ module TestIRB
|
|||
)
|
||||
|
||||
assert_empty(err)
|
||||
assert_match(/undefined local variable or method `__'/, out)
|
||||
assert_match(/undefined local variable or method [`']__'/, out)
|
||||
end
|
||||
|
||||
def test_eval_history_can_be_retrieved_with_double_underscore
|
||||
|
|
|
@ -61,7 +61,7 @@ IRB
|
|||
# TruffleRuby warns when the locale does not exist
|
||||
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 --]
|
||||
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")
|
||||
require_relative 'euc'
|
||||
raise_euc_with_invalid_byte_sequence
|
||||
|
|
|
@ -171,7 +171,7 @@ class TestRipper::Lexer < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
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'],
|
||||
[:assign_error, 'begin; nil = 1; end', %r[assign to nil], 'nil'],
|
||||
[:alias_error, 'begin; alias $x $1; end', %r[number variables], '$1'],
|
||||
|
|
|
@ -1644,20 +1644,20 @@ class TestRipper::ParserEvents < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_invalid_instance_variable_name
|
||||
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("'@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('@'))
|
||||
end
|
||||
|
||||
def test_invalid_class_variable_name
|
||||
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("'@@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('@@'))
|
||||
end
|
||||
|
||||
def test_invalid_global_variable_name
|
||||
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("'$%' 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
|
||||
|
||||
def test_warning_ignored_magic_comment
|
||||
|
|
|
@ -216,7 +216,7 @@ class TestBacktrace < Test::Unit::TestCase
|
|||
end
|
||||
@line = __LINE__ + 1
|
||||
[1].map.map { [1].map.map { foo } }
|
||||
assert_equal("[\"#{__FILE__}:#{@line}:in `map'\"]", @res)
|
||||
assert_equal("[\"#{__FILE__}:#{@line}:in 'map'\"]", @res)
|
||||
end
|
||||
|
||||
def test_caller_location_path_cfunc_iseq_no_pc
|
||||
|
@ -384,11 +384,11 @@ class TestBacktrace < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_notty_backtrace
|
||||
err = ["-:1:in `<main>': unhandled exception"]
|
||||
err = ["-:1:in '<main>': unhandled exception"]
|
||||
assert_in_out_err([], "raise", [], err)
|
||||
|
||||
err = ["-:2:in `foo': foo! (RuntimeError)",
|
||||
"\tfrom -:4:in `<main>'"]
|
||||
err = ["-:2:in 'foo': foo! (RuntimeError)",
|
||||
"\tfrom -:4:in '<main>'"]
|
||||
assert_in_out_err([], <<-"end;", [], err)
|
||||
def foo
|
||||
raise "foo!"
|
||||
|
@ -396,12 +396,12 @@ class TestBacktrace < Test::Unit::TestCase
|
|||
foo
|
||||
end;
|
||||
|
||||
err = ["-:7:in `rescue in bar': bar! (RuntimeError)",
|
||||
"\tfrom -:4:in `bar'",
|
||||
"\tfrom -:9:in `<main>'",
|
||||
"-:2:in `foo': foo! (RuntimeError)",
|
||||
"\tfrom -:5:in `bar'",
|
||||
"\tfrom -:9:in `<main>'"]
|
||||
err = ["-:7:in 'rescue in bar': bar! (RuntimeError)",
|
||||
"\tfrom -:4:in 'bar'",
|
||||
"\tfrom -:9:in '<main>'",
|
||||
"-:2:in 'foo': foo! (RuntimeError)",
|
||||
"\tfrom -:5:in 'bar'",
|
||||
"\tfrom -:9:in '<main>'"]
|
||||
assert_in_out_err([], <<-"end;", [], err)
|
||||
def foo
|
||||
raise "foo!"
|
||||
|
@ -416,7 +416,7 @@ class TestBacktrace < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
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]")
|
||||
def foo
|
||||
return to_enum(__method__) unless block_given?
|
||||
|
|
|
@ -67,7 +67,7 @@ class TestBeginEndBlock < Test::Unit::TestCase
|
|||
bug8501 = '[ruby-core:55365] [Bug #8501]'
|
||||
args = ['-e', 'o = Object.new; def o.inspect; raise "[Bug #8501]"; end',
|
||||
'-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)
|
||||
end
|
||||
|
||||
|
|
|
@ -789,15 +789,15 @@ class TestClass < Test::Unit::TestCase
|
|||
c.attached_object
|
||||
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
|
||||
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
|
||||
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
|
||||
end
|
||||
end
|
||||
|
|
|
@ -809,7 +809,7 @@ end.join
|
|||
def test_cause_at_end
|
||||
errs = [
|
||||
/-: unexpected return\n/,
|
||||
/.*undefined local variable or method `n'.*\n/,
|
||||
/.*undefined local variable or method 'n'.*\n/,
|
||||
]
|
||||
assert_in_out_err([], <<-'end;', [], errs)
|
||||
END{n}; END{return}
|
||||
|
@ -1045,7 +1045,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
|
|||
end
|
||||
|
||||
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_function :foo
|
||||
end
|
||||
|
@ -1093,7 +1093,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
|
|||
|
||||
def 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([], capture_warning_warn {warn})
|
||||
|
@ -1169,7 +1169,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
|
|||
end
|
||||
|
||||
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
|
||||
def warn(message)
|
||||
|
@ -1443,7 +1443,7 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status|
|
|||
end
|
||||
|
||||
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
|
||||
end
|
||||
end;
|
||||
|
|
|
@ -157,12 +157,12 @@ class TestISeq < Test::Unit::TestCase
|
|||
y = nil.instance_eval do
|
||||
eval("proc {#{name} = []; proc {|x| #{name}}}").call
|
||||
end
|
||||
assert_raise_with_message(Ractor::IsolationError, /`#{name}'/) do
|
||||
assert_raise_with_message(Ractor::IsolationError, /'#{name}'/) do
|
||||
Ractor.make_shareable(y)
|
||||
end
|
||||
obj = Object.new
|
||||
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)
|
||||
end
|
||||
end
|
||||
|
@ -367,7 +367,7 @@ class TestISeq < Test::Unit::TestCase
|
|||
f.puts "end"
|
||||
f.close
|
||||
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;
|
||||
path = ARGV[0]
|
||||
begin
|
||||
|
|
|
@ -1453,12 +1453,12 @@ class TestMethod < Test::Unit::TestCase
|
|||
begin
|
||||
$f.call(1)
|
||||
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
|
||||
begin
|
||||
foo(1)
|
||||
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
|
||||
EOS
|
||||
END_OF_BODY
|
||||
|
|
|
@ -1477,7 +1477,7 @@ class TestModule < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
%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
|
||||
Class.new.instance_eval { undef_method(:#{n}) }
|
||||
INPUT
|
||||
|
@ -3348,7 +3348,7 @@ class TestModule < Test::Unit::TestCase
|
|||
methods = singleton_class.private_instance_methods(false)
|
||||
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.#{method}
|
||||
}
|
||||
|
|
|
@ -85,7 +85,7 @@ class TestNoMethodError < Test::Unit::TestCase
|
|||
bug3237 = '[ruby-core:29948]'
|
||||
str = "\u2600"
|
||||
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
|
||||
str.__send__(id)
|
||||
end
|
||||
|
|
|
@ -480,12 +480,12 @@ class TestObject < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
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
|
||||
def (Object.new).object_id; end
|
||||
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
|
||||
def (Object.new).__send__; end
|
||||
INPUT
|
||||
|
@ -528,7 +528,7 @@ class TestObject < Test::Unit::TestCase
|
|||
assert_raise(NoMethodError, bug2202) {o2.meth2}
|
||||
|
||||
%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
|
||||
begin
|
||||
Class.new.instance_eval { remove_method(:#{m}) }
|
||||
|
|
|
@ -378,10 +378,10 @@ class TestParse < Test::Unit::TestCase
|
|||
|
||||
def assert_disallowed_variable(type, noname, invalid)
|
||||
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
|
||||
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
|
||||
|
||||
|
@ -854,7 +854,7 @@ x = __ENCODING__
|
|||
|
||||
def test_float
|
||||
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/)
|
||||
end
|
||||
|
||||
|
@ -882,7 +882,7 @@ x = __ENCODING__
|
|||
|
||||
def test_invalid_char
|
||||
bug10117 = '[ruby-core:64243] [Bug #10117]'
|
||||
invalid_char = /Invalid char `\\x01'/
|
||||
invalid_char = /Invalid char '\\x01'/
|
||||
x = 1
|
||||
assert_in_out_err(%W"-e \x01x", "", [], invalid_char, bug10117)
|
||||
assert_syntax_error("\x01x", invalid_char, bug10117)
|
||||
|
@ -952,14 +952,14 @@ x = __ENCODING__
|
|||
|
||||
def test_assign_in_conditional
|
||||
# multiple assignment
|
||||
assert_warning(/`= literal' in conditional/) do
|
||||
assert_warning(/'= literal' in conditional/) do
|
||||
eval <<-END, nil, __FILE__, __LINE__+1
|
||||
(x, y = 1, 2) ? 1 : 2
|
||||
END
|
||||
end
|
||||
|
||||
# instance variable assignment
|
||||
assert_warning(/`= literal' in conditional/) do
|
||||
assert_warning(/'= literal' in conditional/) do
|
||||
eval <<-END, nil, __FILE__, __LINE__+1
|
||||
if @x = true
|
||||
1
|
||||
|
@ -970,7 +970,7 @@ x = __ENCODING__
|
|||
end
|
||||
|
||||
# local variable assignment
|
||||
assert_warning(/`= literal' in conditional/) do
|
||||
assert_warning(/'= literal' in conditional/) do
|
||||
eval <<-END, nil, __FILE__, __LINE__+1
|
||||
def m
|
||||
if x = true
|
||||
|
@ -984,7 +984,7 @@ x = __ENCODING__
|
|||
|
||||
# global variable assignment
|
||||
assert_separately([], <<-RUBY)
|
||||
assert_warning(/`= literal' in conditional/) do
|
||||
assert_warning(/'= literal' in conditional/) do
|
||||
eval <<-END, nil, __FILE__, __LINE__+1
|
||||
if $x = true
|
||||
1
|
||||
|
@ -996,7 +996,7 @@ x = __ENCODING__
|
|||
RUBY
|
||||
|
||||
# dynamic variable assignment
|
||||
assert_warning(/`= literal' in conditional/) do
|
||||
assert_warning(/'= literal' in conditional/) do
|
||||
eval <<-END, nil, __FILE__, __LINE__+1
|
||||
y = 1
|
||||
|
||||
|
@ -1011,7 +1011,7 @@ x = __ENCODING__
|
|||
end
|
||||
|
||||
# class variable assignment
|
||||
assert_warning(/`= literal' in conditional/) do
|
||||
assert_warning(/'= literal' in conditional/) do
|
||||
eval <<-END, nil, __FILE__, __LINE__+1
|
||||
c = Class.new
|
||||
class << c
|
||||
|
@ -1023,7 +1023,7 @@ x = __ENCODING__
|
|||
|
||||
# constant declaration
|
||||
assert_separately([], <<-RUBY)
|
||||
assert_warning(/`= literal' in conditional/) do
|
||||
assert_warning(/'= literal' in conditional/) do
|
||||
eval <<-END, nil, __FILE__, __LINE__+1
|
||||
if Const = true
|
||||
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 -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: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(-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) + [""], "", [], [])
|
||||
end
|
||||
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/)
|
||||
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 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(-e) + ['p defined? Gem'], "", ["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'
|
||||
assert_in_out_err(%w(), "p Warning[:experimental]", ["false"])
|
||||
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'
|
||||
assert_in_out_err(%w(), "p $VERBOSE", ["true"])
|
||||
|
@ -558,7 +558,7 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||
t.puts " end"
|
||||
t.puts "end"
|
||||
t.flush
|
||||
warning = ' warning: found `= literal\' in conditional, should be =='
|
||||
warning = ' warning: found \'= literal\' in conditional, should be =='
|
||||
err = ["#{t.path}:1:#{warning}",
|
||||
"#{t.path}:4:#{warning}",
|
||||
]
|
||||
|
@ -820,8 +820,8 @@ class TestRubyOptions < Test::Unit::TestCase
|
|||
%r(
|
||||
(?:
|
||||
--\sRuby\slevel\sbacktrace\sinformation\s----------------------------------------\n
|
||||
(?:-e:1:in\s\`(?:block\sin\s)?<main>\'\n)*
|
||||
-e:1:in\s\`kill\'\n
|
||||
(?:-e:1:in\s\'(?:block\sin\s)?<main>\'\n)*
|
||||
-e:1:in\s\'kill\'\n
|
||||
\n
|
||||
)?
|
||||
)x,
|
||||
|
|
|
@ -1123,9 +1123,9 @@ CODE
|
|||
when :line
|
||||
assert_match(/ in /, str)
|
||||
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
|
||||
assert_match(/return \`/, str) # #<TracePoint:return `m' ../trunk/test.rb:3>
|
||||
assert_match(/return \'/, str) # #<TracePoint:return 'm' ../trunk/test.rb:3>
|
||||
when /thread/
|
||||
assert_match(/\#<Thread:/, str) # #<TracePoint:thread_end of #<Thread:0x87076c0>>
|
||||
else
|
||||
|
|
|
@ -491,7 +491,7 @@ class TestSyntax < Test::Unit::TestCase
|
|||
|
||||
def test_warn_balanced
|
||||
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
|
||||
WARN
|
||||
[
|
||||
|
@ -699,7 +699,7 @@ WARN
|
|||
end
|
||||
|
||||
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) {
|
||||
eval %q{
|
||||
case 1
|
||||
|
@ -740,7 +740,7 @@ WARN
|
|||
end
|
||||
|
||||
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)
|
||||
begin;
|
||||
case 1
|
||||
|
@ -1315,7 +1315,7 @@ eom
|
|||
end
|
||||
|
||||
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)")
|
||||
end
|
||||
|
||||
|
@ -1803,7 +1803,7 @@ eom
|
|||
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 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')
|
||||
}
|
||||
['class C', 'class << C', 'module M', 'def m', 'def o.m'].each do |c|
|
||||
|
@ -1826,12 +1826,12 @@ eom
|
|||
|
||||
def test_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_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('->{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_equal(4, eval('->(a=->{it}){a}.call.call(4)'))
|
||||
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(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_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')
|
||||
end
|
||||
['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
|
||||
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. " \
|
||||
"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 " \
|
||||
|
|
|
@ -306,7 +306,7 @@ class TestForwardable < Test::Unit::TestCase
|
|||
|
||||
def test_basicobject_subclass
|
||||
bug11616 = '[ruby-core:71176] [Bug #11616]'
|
||||
assert_raise_with_message(NameError, /`bar'/, bug11616) {
|
||||
assert_raise_with_message(NameError, /'bar'/, bug11616) {
|
||||
Foo2.new.baz
|
||||
}
|
||||
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);
|
||||
th = rb_thread_ptr(thread);
|
||||
if (!threadptr_initialized(th)) {
|
||||
rb_raise(rb_eThreadError, "uninitialized thread - check `%"PRIsVALUE"#initialize'",
|
||||
rb_raise(rb_eThreadError, "uninitialized thread - check '%"PRIsVALUE"#initialize'",
|
||||
klass);
|
||||
}
|
||||
return thread;
|
||||
|
|
8
time.c
8
time.c
|
@ -650,13 +650,13 @@ wv2timet(wideval_t w)
|
|||
wideint_t wi = FIXWV2WINT(w);
|
||||
if (TIMET_MIN == 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)
|
||||
rb_raise(rb_eRangeError, "too big to convert into `time_t'");
|
||||
rb_raise(rb_eRangeError, "too big to convert into 'time_t'");
|
||||
}
|
||||
else {
|
||||
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;
|
||||
}
|
||||
|
@ -2520,7 +2520,7 @@ two_digits(const char *ptr, const char *end, const char **endp, const char *name
|
|||
((len > 2) && ISDIGIT(ptr[2]))) {
|
||||
VALUE mesg = rb_sprintf("two digits %s is expected", name);
|
||||
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_exc_raise(rb_exc_new_str(rb_eArgError, mesg));
|
||||
|
|
|
@ -532,7 +532,7 @@ rb_global_entry(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;
|
||||
}
|
||||
|
@ -906,7 +906,7 @@ rb_gv_get(const char *name)
|
|||
ID id = find_global_id(name);
|
||||
|
||||
if (!id) {
|
||||
rb_warning("global variable `%s' not initialized", name);
|
||||
rb_warning("global variable '%s' not initialized", name);
|
||||
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_name rb_is_const_name
|
||||
#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) \
|
||||
check_id_type(obj, &(name), rb_is_##type##_id, rb_is_##type##_name, message, strlen(message))
|
||||
static ID
|
||||
|
@ -3693,7 +3693,7 @@ rb_define_const(VALUE klass, const char *name, VALUE val)
|
|||
ID id = rb_intern(name);
|
||||
|
||||
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_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"
|
||||
" unshareable object %+" PRIsVALUE " from ", v);
|
||||
if (name)
|
||||
rb_str_catf(msg, "variable `%" PRIsVALUE "'", name);
|
||||
rb_str_catf(msg, "variable '%" PRIsVALUE "'", name);
|
||||
else
|
||||
rb_str_cat_cstr(msg, "a hidden variable");
|
||||
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);
|
||||
}
|
||||
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));
|
||||
}
|
||||
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;
|
||||
|
|
|
@ -396,7 +396,7 @@ location_format(VALUE file, int lineno, VALUE name)
|
|||
rb_str_cat_cstr(s, "unknown method");
|
||||
}
|
||||
else {
|
||||
rb_str_catf(s, "`%s'", RSTRING_PTR(name));
|
||||
rb_str_catf(s, "'%s'", RSTRING_PTR(name));
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
@ -973,7 +973,7 @@ oldbt_print(void *data, VALUE file, int lineno, VALUE name)
|
|||
RSTRING_PTR(file), lineno);
|
||||
}
|
||||
else {
|
||||
fprintf(fp, "\tfrom %s:%d:in `%s'\n",
|
||||
fprintf(fp, "\tfrom %s:%d:in '%s'\n",
|
||||
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);
|
||||
}
|
||||
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");
|
||||
}
|
||||
else {
|
||||
rb_str_catf(str, " `%"PRIsVALUE"'\n", name);
|
||||
rb_str_catf(str, " '%"PRIsVALUE"'\n", name);
|
||||
}
|
||||
(*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)) {
|
||||
rb_raise(rb_eNotImpError,
|
||||
"method `%"PRIsVALUE"' called on unexpected immediate object (%p)",
|
||||
"method '%"PRIsVALUE"' called on unexpected immediate object (%p)",
|
||||
mname, (void *)recv);
|
||||
}
|
||||
else if ((flags = RBASIC(recv)->flags) == 0) {
|
||||
rb_raise(rb_eNotImpError,
|
||||
"method `%"PRIsVALUE"' called on terminated object (%p)",
|
||||
"method '%"PRIsVALUE"' called on terminated object (%p)",
|
||||
mname, (void *)recv);
|
||||
}
|
||||
else if (!(typestr = rb_type_str(type = BUILTIN_TYPE(recv)))) {
|
||||
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")",
|
||||
mname, type, (void *)recv, flags);
|
||||
}
|
||||
else if (T_OBJECT <= type && type < T_NIL) {
|
||||
rb_raise(rb_eNotImpError,
|
||||
"method `%"PRIsVALUE"' called on hidden %s object"
|
||||
"method '%"PRIsVALUE"' called on hidden %s object"
|
||||
" (%p flags=0x%"PRIxVALUE")",
|
||||
mname, typestr, (void *)recv, flags);
|
||||
}
|
||||
else {
|
||||
rb_raise(rb_eNotImpError,
|
||||
"method `%"PRIsVALUE"' called on unexpected %s object"
|
||||
"method '%"PRIsVALUE"' called on unexpected %s object"
|
||||
" (%p flags=0x%"PRIxVALUE")",
|
||||
mname, typestr, (void *)recv, flags);
|
||||
}
|
||||
|
@ -956,7 +956,7 @@ rb_make_no_method_exception(VALUE exc, VALUE format, VALUE obj,
|
|||
VALUE name = argv[0];
|
||||
|
||||
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) {
|
||||
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);
|
||||
|
||||
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) {
|
||||
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) {
|
||||
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;
|
||||
}
|
||||
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 */
|
||||
if (mid == object_id || mid == id__send__) {
|
||||
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);
|
||||
klass = RCLASS_ORIGIN(klass);
|
||||
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) ||
|
||||
!(me = (rb_method_entry_t *)data) ||
|
||||
(!me->def || me->def->type == VM_METHOD_TYPE_UNDEF) ||
|
||||
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));
|
||||
}
|
||||
|
||||
|
@ -1606,7 +1606,7 @@ rb_mod_remove_method(int argc, VALUE *argv, VALUE mod)
|
|||
VALUE v = argv[i];
|
||||
ID id = rb_check_id(&v);
|
||||
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);
|
||||
}
|
||||
remove_method(mod, id);
|
||||
|
@ -1779,7 +1779,7 @@ rb_undef(VALUE klass, ID id)
|
|||
}
|
||||
rb_class_modify_check(klass);
|
||||
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);
|
||||
|
@ -1839,7 +1839,7 @@ rb_undef(VALUE klass, ID id)
|
|||
*
|
||||
* In child
|
||||
* In parent
|
||||
* prog.rb:23: undefined method `hello' for #<Child:0x401b3bb4> (NoMethodError)
|
||||
* prog.rb:23: undefined method 'hello' for #<Child:0x401b3bb4> (NoMethodError)
|
||||
*/
|
||||
|
||||
static VALUE
|
||||
|
|
|
@ -1527,7 +1527,7 @@ tracepoint_inspect(rb_execution_context_t *ec, VALUE self)
|
|||
VALUE sym = rb_tracearg_method_id(trace_arg);
|
||||
if (NIL_P(sym))
|
||||
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_path(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_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_method_id(trace_arg),
|
||||
rb_tracearg_path(trace_arg),
|
||||
|
|
|
@ -263,7 +263,7 @@ rb_default_home_dir(VALUE result)
|
|||
{
|
||||
WCHAR *dir = rb_w32_home_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,
|
||||
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();
|
||||
if (whome == NULL) {
|
||||
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);
|
||||
|
||||
|
@ -404,7 +404,7 @@ rb_file_expand_path_internal(VALUE fname, VALUE dname, int abs_mode, int long_na
|
|||
if (whome == NULL) {
|
||||
free(wpath);
|
||||
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);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче