Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make the test suite compatible with --enable-frozen-string-literal #159

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ jobs:
fail-fast: false
matrix:
ruby: ${{ fromJson(needs.ruby-versions.outputs.versions) }}
include:
- ruby: "3.3"
rubyopt: "--enable-frozen-string-literal"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -35,5 +38,5 @@ jobs:
- run: bundle exec typeprof --version
- name: Run the test suite
run: |
bundle exec rake TESTOPT=-v
bundle exec rake TESTOPT=-v RUBYOPT="${{ matrix.rubyopt }}"
if: ${{ !startsWith(matrix.ruby, 'truffle') }}
4 changes: 2 additions & 2 deletions lib/typeprof/type.rb
Original file line number Diff line number Diff line change
Expand Up @@ -861,7 +861,7 @@ class Signature
include Utils::StructuralEquality

def screen_name(iseq, scratch)
fargs_str = "("
fargs_str = +"("
sig_help = {}
add_farg = -> farg, name, help: false, key: sig_help.size do
name = "`#{ name }`" if RBS::Parser::KEYWORDS.key?(name.to_s)
Expand Down Expand Up @@ -917,7 +917,7 @@ def screen_name(iseq, scratch)

fargs_str << ")"

fargs_str = "" if fargs_str == "()"
fargs_str = +"" if fargs_str == "()"

# Dirty Hack: Stop the iteration at most once!
# I'll remove this hack if RBS removes the limitation of nesting blocks
Expand Down
6 changes: 3 additions & 3 deletions test/typeprof/cli_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class CLITest < Test::Unit::TestCase
rb_file = File.join(__dir__, "../../smoke/simple.rb")
rb_files = [rb_file, rb_file]
rbs_files = []
output = StringIO.new("")
output = StringIO.new(+"")
options = {}
options[:show_untyped] = true
options[:show_errors] = true
Expand Down Expand Up @@ -37,7 +37,7 @@ def foo: (Integer n) -> String
rb_file = File.join(__dir__, "../../smoke/any1.rb")
rb_files = [rb_file]
rbs_files = []
output = StringIO.new("")
output = StringIO.new(+"")
options = {}
options[:exclude_untyped] = true
options[:show_untyped] = true
Expand Down Expand Up @@ -67,7 +67,7 @@ class Object
rb_file = File.join(__dir__, "../../smoke/simple.rb")
rb_files = [rb_file]
rbs_files = [["test.rbs", "class Bar < Foo\nend"]]
output = StringIO.new("")
output = StringIO.new(+"")
options = {}
options[:show_untyped] = true
options[:show_errors] = true
Expand Down
2 changes: 1 addition & 1 deletion test/typeprof/test_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def run(gem_rbs_features: [], **options)

rb_files = [@name]
rbs_files = [@rbs_path].compact
output = StringIO.new("")
output = StringIO.new(+"")
options[:show_untyped] = true unless options.key?(:show_untyped)
options[:show_errors] = true unless options.key?(:show_errors)
options[:show_indicator] = false unless options.key?(:show_indicator)
Expand Down