Skip to content

Commit 549fbcf

Browse files
committed
Address warning: literal string will be frozen in the future
This commit addresses the following warnings. - Steps to reproduce: ```ruby $ ruby -v ruby 3.4.0dev (2024-10-26T13:20:34Z master 484ea00d2e) +PRISM [x86_64-linux] $ RUBYOPT="--debug-frozen-string-literal" bundle exec thor spec ``` - Warnings addressed by this commit: ``` /path/to/thor/spec/base_spec.rb:322: warning: literal string will be frozen in the future /path/to/thor/spec/base_spec.rb:321: info: the string was created here ``` ``` /path/to/thor/spec/parser/options_spec.rb:121: warning: literal string will be frozen in the future /path/to/thor/spec/parser/options_spec.rb:120: info: the string was created here ``` Refer to: https://bugs.ruby-lang.org/issues/20205 ruby/ruby#11893
1 parent b19962a commit 549fbcf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

spec/base_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def hello
318318
end
319319

320320
it "suggests commands that are similar if there is a typo" do
321-
expected = "Could not find command \"paintz\" in \"barn\" namespace.\n"
321+
expected = "Could not find command \"paintz\" in \"barn\" namespace.\n".dup
322322
expected << "Did you mean? \"paint\"\n" if Thor::Correctable
323323

324324
expect(capture(:stderr) { Barn.start(%w(paintz)) }).to eq(expected)

spec/parser/options_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ def remaining
117117
create foo: "baz", bar: :required
118118
parse("--bar", "baz", "--baz", "unknown")
119119

120-
expected = "Unknown switches \"--baz\""
120+
expected = "Unknown switches \"--baz\"".dup
121121
expected << "\nDid you mean? \"--bar\"" if Thor::Correctable
122122

123123
expect { check_unknown! }.to raise_error(Thor::UnknownArgumentError) do |error|

0 commit comments

Comments
 (0)