Project

General

Profile

Feature #14240 » warn-5-gvars.patch

jeremyevans0 (Jeremy Evans), 07/26/2019 11:15 PM

View differences:

parse.y
pushback(p, c);
c = '_';
/* fall through */
case '/': /* $/: input record separator */
case '\\': /* $\: output record separator */
case ';': /* $;: field separator */
case ',': /* $,: output field separator */
case '.': /* $.: last read line number */
if (c != '_' && strcmp(p->ruby_sourcefile, "-e")) {
rb_warn("global variable $%c is deprecated", c);
}
/* fall through */
case '~': /* $~: match-data */
case '*': /* $*: argv */
case '$': /* $$: pid */
case '?': /* $?: last status */
case '!': /* $!: error string */
case '@': /* $@: error position */
case '/': /* $/: input record separator */
case '\\': /* $\: output record separator */
case ';': /* $;: field separator */
case ',': /* $,: output field separator */
case '.': /* $.: last read line number */
case '=': /* $=: ignorecase */
case ':': /* $:: load path */
case '<': /* $<: reading filename */
test/ruby/test_syntax.rb
end
end
def test_deprecated_global_variable
assert_warning(/global variable \$; is deprecated/) { eval('$;') }
assert_warning(/global variable \$, is deprecated/) { eval('$,') }
assert_warning(/global variable \$\/ is deprecated/) { eval('$/') }
assert_warning(/global variable \$\\ is deprecated/) { eval('$\\') }
assert_warning(/global variable \$\. is deprecated/) { eval('$.') }
end
Bug7559 = '[ruby-dev:46737]'
def test_lineno_command_call_quote
(1-1/3)