From 8b9a3eaba6c6af525974f7f41025d3371918931d Mon Sep 17 00:00:00 2001 From: kazu Date: Sat, 24 Feb 2018 08:54:19 +0000 Subject: [PATCH] lib/erb.rb: Add uplevel to warn git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62563 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/erb.rb | 6 +++--- test/erb/test_erb_command.rb | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/erb.rb b/lib/erb.rb index c50d3eac48..2247838ded 100644 --- a/lib/erb.rb +++ b/lib/erb.rb @@ -805,16 +805,16 @@ class ERB def initialize(str, safe_level=NOT_GIVEN, legacy_trim_mode=NOT_GIVEN, legacy_eoutvar=NOT_GIVEN, trim_mode: nil, eoutvar: '_erbout') # Complex initializer for $SAFE deprecation at Feature #14256, which should be removed at Ruby 2.7. if safe_level != NOT_GIVEN - warn 'warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments.' + warn 'Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments.', uplevel: 1 else safe_level = nil end if legacy_trim_mode != NOT_GIVEN - warn 'warning: Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead.' + warn 'Passing trim_mode with the 3rd argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, trim_mode: ...) instead.', uplevel: 1 trim_mode = legacy_trim_mode end if legacy_eoutvar != NOT_GIVEN - warn 'warning: Passing eoutvar with the 4th argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, eoutvar: ...) instead.' + warn 'Passing eoutvar with the 4th argument of ERB.new is deprecated. Use keyword argument like ERB.new(str, eoutvar: ...) instead.', uplevel: 1 eoutvar = legacy_eoutvar end diff --git a/test/erb/test_erb_command.rb b/test/erb/test_erb_command.rb index ac87b07740..ed13c29c96 100644 --- a/test/erb/test_erb_command.rb +++ b/test/erb/test_erb_command.rb @@ -20,7 +20,7 @@ class TestErbCommand < Test::Unit::TestCase def test_deprecated_option warnings = [ "warning: -S option of erb command is deprecated. Please do not use this.", - "warning: Passing safe_level with the 2nd argument of ERB.new is deprecated. Do not use it, and specify other arguments as keyword arguments.", + /\n.+\/bin\/erb:\d+: warning: Passing safe_level with the 2nd argument of ERB\.new is deprecated\. Do not use it, and specify other arguments as keyword arguments\.\n/, ] assert_in_out_err(["-w", File.expand_path("../../../bin/erb", __FILE__),