summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-05 07:54:32 +0000
committerkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-02-05 07:54:32 +0000
commite3300dce829955390b5099c013ab4452a74ffd20 (patch)
tree15ee88b1ac001411f23f966c5c5ebbc9d02fa848 /test
parentcd6d919373f2d0a1631b10a666d892365407821c (diff)
{ext,test}/ripper: Specify frozen_string_literal: true.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57538 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ripper/dummyparser.rb4
-rw-r--r--test/ripper/test_files.rb2
-rw-r--r--test/ripper/test_filter.rb2
-rw-r--r--test/ripper/test_parser_events.rb1
-rw-r--r--test/ripper/test_ripper.rb14
-rw-r--r--test/ripper/test_scanner_events.rb4
-rw-r--r--test/ripper/test_sexp.rb2
7 files changed, 15 insertions, 14 deletions
diff --git a/test/ripper/dummyparser.rb b/test/ripper/dummyparser.rb
index 3c196d9a23..05220dc897 100644
--- a/test/ripper/dummyparser.rb
+++ b/test/ripper/dummyparser.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
#
# dummyparser.rb
#
@@ -186,7 +186,7 @@ class DummyParser < Ripper
end
def on_word_new
- ""
+ "".dup
end
def on_word_add(word, w)
diff --git a/test/ripper/test_files.rb b/test/ripper/test_files.rb
index ac24727e9b..d90cd6479e 100644
--- a/test/ripper/test_files.rb
+++ b/test/ripper/test_files.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
require 'test/unit'
module TestRipper; end
diff --git a/test/ripper/test_filter.rb b/test/ripper/test_filter.rb
index 0f9d38f726..d025cf5a98 100644
--- a/test/ripper/test_filter.rb
+++ b/test/ripper/test_filter.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
begin
require 'ripper'
require 'test/unit'
diff --git a/test/ripper/test_parser_events.rb b/test/ripper/test_parser_events.rb
index 540d36e4d9..7af2019a09 100644
--- a/test/ripper/test_parser_events.rb
+++ b/test/ripper/test_parser_events.rb
@@ -1,3 +1,4 @@
+# frozen_string_literal: true
begin
require_relative 'dummyparser'
require 'test/unit'
diff --git a/test/ripper/test_ripper.rb b/test/ripper/test_ripper.rb
index b99feb7f83..79cbf88a15 100644
--- a/test/ripper/test_ripper.rb
+++ b/test/ripper/test_ripper.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
begin
require 'ripper'
require 'test/unit'
@@ -37,7 +37,7 @@ class TestRipper::Ripper < Test::Unit::TestCase
def test_filename
assert_equal '(ripper)', @ripper.filename
- filename = "ripper"
+ filename = "ripper".dup
ripper = Ripper.new("", filename)
filename.clear
assert_equal "ripper", ripper.filename
@@ -63,11 +63,11 @@ class TestRipper::Ripper < Test::Unit::TestCase
def test_regexp_with_option
bug11932 = '[ruby-core:72638] [Bug #11932]'
- src = '/[\xC0-\xF0]/u'.force_encoding(Encoding::UTF_8)
+ src = '/[\xC0-\xF0]/u'.dup.force_encoding(Encoding::UTF_8)
ripper = Ripper.new(src)
ripper.parse
assert_predicate(ripper, :error?)
- src = '/[\xC0-\xF0]/n'.force_encoding(Encoding::UTF_8)
+ src = '/[\xC0-\xF0]/n'.dup.force_encoding(Encoding::UTF_8)
ripper = Ripper.new(src)
ripper.parse
assert_not_predicate(ripper, :error?, bug11932)
@@ -101,11 +101,11 @@ class TestRipper::Ripper < Test::Unit::TestCase
# https://bugs.jruby.org/4176
def test_dedent_string
- col = Ripper.dedent_string ' hello', 0
+ col = Ripper.dedent_string ' hello'.dup, 0
assert_equal 0, col
- col = Ripper.dedent_string ' hello', 2
+ col = Ripper.dedent_string ' hello'.dup, 2
assert_equal 2, col
- col = Ripper.dedent_string ' hello', 4
+ col = Ripper.dedent_string ' hello'.dup, 4
assert_equal 2, col
# lexing a squiggly heredoc triggers Ripper#dedent_string use
diff --git a/test/ripper/test_scanner_events.rb b/test/ripper/test_scanner_events.rb
index 1b7b56ebfe..7ae58bbda8 100644
--- a/test/ripper/test_scanner_events.rb
+++ b/test/ripper/test_scanner_events.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
#
# test_scanner_events.rb
#
@@ -134,7 +134,7 @@ class TestRipper::ScannerEvents < Test::Unit::TestCase
end
def assert_location(src)
- buf = ''
+ buf = ''.dup
Ripper.lex(src).each do |pos, type, tok|
line, col = *pos
assert_equal buf.count("\n") + 1, line,
diff --git a/test/ripper/test_sexp.rb b/test/ripper/test_sexp.rb
index 46fb7f292a..26d19b13a6 100644
--- a/test/ripper/test_sexp.rb
+++ b/test/ripper/test_sexp.rb
@@ -1,4 +1,4 @@
-# frozen_string_literal: false
+# frozen_string_literal: true
begin
require 'ripper'
require 'test/unit'