From e1b66cc2a88a7244e5f3f057610a622e8c7ef0d0 Mon Sep 17 00:00:00 2001 From: Daniel Mendler Date: Sun, 23 Apr 2023 10:26:10 +0200 Subject: [PATCH] Ensure that tests work with --enable-frozen-string-literal Adjust the RUBYOPT variable before running the tests. export RUBYOPT=--enable-frozen-string-literal --- test/core/helper.rb | 2 +- test/core/test_encoding.rb | 4 ++-- test/literate/run.rb | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/core/helper.rb b/test/core/helper.rb index 5bfc5b60..5d3bcd5f 100644 --- a/test/core/helper.rb +++ b/test/core/helper.rb @@ -121,7 +121,7 @@ def call_macro(name, *args) end def hello_world(text = "Hello World from @env", opts = {}) - text << opts.to_a * " " if opts.any? + text = text + (opts.to_a * " ") if opts.any? if block_given? "#{text} #{yield} #{text}" else diff --git a/test/core/test_encoding.rb b/test/core/test_encoding.rb index b69ce5fa..d8c2d7af 100644 --- a/test/core/test_encoding.rb +++ b/test/core/test_encoding.rb @@ -8,10 +8,10 @@ def test_windows_crlf end def test_binary - source = "| \xFF\xFF" + source = "| \xFF\xFF".dup source.force_encoding(Encoding::BINARY) - result = "\xFF\xFF" + result = "\xFF\xFF".dup result.force_encoding(Encoding::BINARY) out = render(source, default_encoding: 'binary') diff --git a/test/literate/run.rb b/test/literate/run.rb index 30b665a1..b2b8abb0 100644 --- a/test/literate/run.rb +++ b/test/literate/run.rb @@ -63,7 +63,7 @@ def on_slim(code) def on_html(code) raise Temple::FilterError, 'Html block must be preceded by slim block' unless @in_testcase @in_testcase = false - result = " html = #{code.inspect}\n" + result = " html = #{code.inspect}\n".dup if @opts.empty? result << " _(render(slim)).must_equal html\nend\n" else