Skip to content

Commit 84e8512

Browse files
authored
Merge pull request #48 from casperisfine/frozen-string-literals
Make the test suite compatible with `--enable-frozen-string-literal`
2 parents 297fa68 + 78dd2ab commit 84e8512

File tree

3 files changed

+12
-7
lines changed

3 files changed

+12
-7
lines changed

.github/workflows/ci.yml

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ jobs:
1616
ruby-version: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
1717
os: [ ubuntu-latest, macos-latest, windows-latest ]
1818
TEST_SYMLINK: [ yes, no ]
19+
include:
20+
- ruby-version: "3.3"
21+
os: "ubuntu-latest"
22+
TEST_SYMLINK: yes
23+
rubyopt: "--enable-frozen-string-literal"
1924
runs-on: ${{ matrix.os }}
2025
env:
2126
TEST_SYMLINK: ${{ matrix.TEST_SYMLINK }}
@@ -32,7 +37,7 @@ jobs:
3237
bundle exec rake before_script
3338
- name: Run the test suite
3439
run: |
35-
bundle exec rake
40+
bundle exec rake RUBYOPT="${{ matrix.rubyopt }}"
3641
- name: Run after_script
3742
run: |
3843
bundle exec rake after_script

lib/power_assert/inspector.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,13 @@ def inspect
4949
if PowerAssert.configuration.inspector == :pp
5050
console_width = IO.respond_to?(:console_size) ? IO.console_size[1] : 80
5151
width = [console_width - 1 - @indent, 10].max
52-
IRB::ColorPrinter.pp(@value, '', width)
52+
IRB::ColorPrinter.pp(@value, +'', width)
5353
else
5454
IRB::Color.colorize_code(@value.to_s, ignore_error: true)
5555
end
5656
else
5757
if PowerAssert.configuration.inspector == :pp
58-
PP.pp(@value, '')
58+
PP.pp(@value, +'')
5959
else
6060
@value.inspect
6161
end

test/block_test.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -428,9 +428,9 @@ def foo
428428
sub_test_case 'assertion_message_with_incompatible_encodings' do
429429
if Encoding.default_external == Encoding::UTF_8
430430
t do
431-
a = "\u3042"
431+
a = +"\u3042"
432432
def a.inspect
433-
super.encode('utf-16le')
433+
super.encode(Encoding::UTF_16LE)
434434
end
435435
assert_equal <<END.chomp, assertion_message {
436436
a + a
@@ -445,9 +445,9 @@ def a.inspect
445445
end
446446

447447
t do
448-
a = "\xFF"
448+
a = +"\xFF"
449449
def a.inspect
450-
"\xFF".force_encoding('ascii-8bit')
450+
"\xFF".dup.force_encoding(Encoding::BINARY)
451451
end
452452
assert_equal <<END.chomp.b, assertion_message {
453453
a.length

0 commit comments

Comments
 (0)