Skip to content

Commit

Permalink
Merge pull request #41 from Shopify/frozen-string-literal-ci
Browse files Browse the repository at this point in the history
Run CI with --enable-frozen-string-literal
  • Loading branch information
maximecb authored Apr 4, 2024
2 parents 5cc9966 + 44c9679 commit fe141fc
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu]
ruby: [ head, 3.2 ]
ruby: [ head, '3.2', '3.3' ]
ruby-opt: [""]
include:
- ruby: "3.3"
ruby-opt: "--enable-frozen-string-literal --debug-frozen-string-literal"

steps:
- name: Install Protoc
Expand All @@ -24,5 +28,5 @@ jobs:

- name: Install dependencies
run: bundle install
- name: Run tests
run: bundle exec rake
- name: Run tests ${{ matrix.rubyopt }}
run: bundle exec rake RUBYOPT="${{ matrix.rubyopt }}"
5 changes: 3 additions & 2 deletions lib/protoboeuf/parser.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# frozen_string_literal: true
# Parser for the protobuf (proto3) language:
# https://protobuf.dev/programming-guides/proto3/
#
Expand Down Expand Up @@ -719,7 +720,7 @@ def eat_ws()
# bar_bif
# foo123
def read_ident
name = ''
name = +''

loop do
if eof?
Expand All @@ -745,7 +746,7 @@ def read_ident
# Read a string constant, eg:
# 'foobar'
def read_string
str = ''
str = +''

# The string must start with an opening quote
expect '"'
Expand Down
4 changes: 2 additions & 2 deletions test/message_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,7 @@ def test_translate_known_type_int32

instance = HasKnownTypeInt32.decode(data)
assert_kind_of ::ProtoBoeuf::Protobuf::Int32Value, instance.id
assert_equal -123456, instance.id.value
assert_equal(-123456, instance.id.value)
end

def test_translate_known_type_int64
Expand All @@ -499,7 +499,7 @@ def test_translate_known_type_int64

instance = HasKnownTypeInt64.decode(data)
assert_kind_of ::ProtoBoeuf::Protobuf::Int64Value, instance.id
assert_equal -123456, instance.id.value
assert_equal(-123456, instance.id.value)
end

def test_translate_known_type_uint32
Expand Down

0 comments on commit fe141fc

Please sign in to comment.