Skip to content

Commit

Permalink
Suppress "literal string will be frozen" warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed Sep 12, 2024
1 parent fdaf318 commit 5a7b104
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 10 deletions.
18 changes: 17 additions & 1 deletion lib/rabbit/source/argf.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Copyright (C) 2004-2024 Sutou Kouhei <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

require "rabbit/source/base"

module Rabbit
Expand All @@ -21,7 +37,7 @@ def _read
@argf.read
rescue
@logger.error($!.message)
""
+""
end
end
end
Expand Down
18 changes: 17 additions & 1 deletion lib/rabbit/source/file.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Copyright (C) 2004-2024 Sutou Kouhei <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

require 'rabbit/source/base'

module Rabbit
Expand Down Expand Up @@ -25,7 +41,7 @@ def _read
rescue SourceUnreadableError
@logger.error($!.message)
@mtime = Time.now + LimitAccessInterval::MINIMUM_ACCESS_TIME
""
+""
end
end

Expand Down
18 changes: 17 additions & 1 deletion lib/rabbit/source/uri.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Copyright (C) 2004-2024 Sutou Kouhei <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

require "uri"
require "open-uri"

Expand Down Expand Up @@ -52,7 +68,7 @@ def _read
rescue
@logger.error($!.message)
@last_modified = Time.now + MINIMUM_ACCESS_TIME
""
+""
end
end

Expand Down
6 changes: 3 additions & 3 deletions test/parser/test-rd.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2014-2019 Kouhei Sutou <[email protected]>
# Copyright (C) 2014-2024 Sutou Kouhei <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -32,11 +32,11 @@ def match?(content)
end

def test_with_space
assert_true(match?("= Hello"))
assert_true(match?(+"= Hello"))
end

def test_no_space
assert_true(match?("=Hello"))
assert_true(match?(+"=Hello"))
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions test/parser/test-wiki.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2015-2019 Kouhei Sutou <[email protected]>
# Copyright (C) 2015-2024 Sutou Kouhei <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -34,7 +34,7 @@ class ImageTest < self
class InlineTest < self
test "unsupported" do
image_path = fixture_path("image/png/lavie.png")
wiki_text = <<-WIKI
wiki_text = +<<-WIKI
! Title
! Slide
Expand Down
4 changes: 2 additions & 2 deletions test/test-source.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2004-2019 Kouhei Sutou <[email protected]>
# Copyright (C) 2004-2024 Kouhei Sutou <[email protected]>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
Expand Down Expand Up @@ -35,7 +35,7 @@ def guess_encoding(string)

class ReadTest < self
def test_binary
pdf_header = "%PDF-1.5\n%\xb5\xed\xae\xfb\n"
pdf_header = +"%PDF-1.5\n%\xb5\xed\xae\xfb\n"
pdf_header.force_encoding("ASCII-8BIT")
assert_equal(pdf_header, read(pdf_header))
end
Expand Down

0 comments on commit 5a7b104

Please sign in to comment.