summaryrefslogtreecommitdiff
path: root/test/erb/test_erb_command.rb
diff options
context:
space:
mode:
authorTakashi Kokubun <takashikkbn@gmail.com>2022-01-17 12:37:46 -0800
committerTakashi Kokubun <takashikkbn@gmail.com>2022-01-17 12:39:17 -0800
commitc0d18a1aa2be26d416f4c5d1809533143374b863 (patch)
tree7a9562e18f4ebfa97261b8f539a1d7f48bd485df /test/erb/test_erb_command.rb
parentf3c77bd480834f2835fe6fef5c0475336248dbde (diff)
[ruby/erb] Revert "Remove safe_level and further positional arguments (https://github.com/ruby/erb/pull/7)"
This reverts commit https://github.com/ruby/erb/commit/5133efa06f0603ae79292f3b2b942957bc8a442e. While we already handled this deprecation in many libraries, we noticed that some (e.g. sprockets) relied on the format of `ERB.version` and https://github.com/ruby/erb/commit/2b4182eb108b9e42fa30bcfa41931896132f88b8 broke such handling. Given that the `ERB.version` change was released at 3.1 and it's obviously new, I'll skip this removal in 3.2 and postpone this to a future version.
Diffstat (limited to 'test/erb/test_erb_command.rb')
-rw-r--r--test/erb/test_erb_command.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/erb/test_erb_command.rb b/test/erb/test_erb_command.rb
index ef170744c2..0baa59ddd5 100644
--- a/test/erb/test_erb_command.rb
+++ b/test/erb/test_erb_command.rb
@@ -15,4 +15,16 @@ class TestErbCommand < Test::Unit::TestCase
File.expand_path("../../libexec/erb", __dir__)],
"<%=''.encoding.to_s%>", ["UTF-8"])
end
+
+ # These interfaces will be removed at Ruby 2.7.
+ def test_deprecated_option
+ warnings = [
+ "warning: -S option of erb command is deprecated. Please do not use this.",
+ /\n.+\/libexec\/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(["-I#{File.expand_path('../../lib', __dir__)}", "-w",
+ File.expand_path("../../libexec/erb", __dir__),
+ "-S", "0"],
+ "hoge", ["hoge"], warnings)
+ end
end