From 8edb6ce4f7920dadcead21dc064557ea7c8b9e25 Mon Sep 17 00:00:00 2001 From: kazu Date: Fri, 27 Jan 2017 00:29:21 +0000 Subject: [PATCH] {ext,test}/date: Specify frozen_string_literal: true. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57432 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ext/date/extconf.rb | 2 +- ext/date/lib/date.rb | 2 +- test/date/test_date.rb | 2 +- test/date/test_date_arith.rb | 2 +- test/date/test_date_attr.rb | 2 +- test/date/test_date_base.rb | 2 +- test/date/test_date_compat.rb | 2 +- test/date/test_date_conv.rb | 2 +- test/date/test_date_marshal.rb | 2 +- test/date/test_date_new.rb | 2 +- test/date/test_date_parse.rb | 2 +- test/date/test_date_strftime.rb | 2 +- test/date/test_date_strptime.rb | 2 +- test/date/test_switch_hitter.rb | 34 ++++++++++++++++----------------- 14 files changed, 30 insertions(+), 30 deletions(-) diff --git a/ext/date/extconf.rb b/ext/date/extconf.rb index e8596952de..a4f243ee10 100644 --- a/ext/date/extconf.rb +++ b/ext/date/extconf.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'mkmf' config_string("strict_warnflags") {|w| $warnflags += " #{w}"} create_makefile('date_core') diff --git a/ext/date/lib/date.rb b/ext/date/lib/date.rb index c10441e573..9170a99ae9 100644 --- a/ext/date/lib/date.rb +++ b/ext/date/lib/date.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true # date.rb: Written by Tadayoshi Funaba 1998-2011 require 'date_core' diff --git a/test/date/test_date.rb b/test/date/test_date.rb index 247cce1eaf..531495d87e 100644 --- a/test/date/test_date.rb +++ b/test/date/test_date.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'test/unit' require 'date' diff --git a/test/date/test_date_arith.rb b/test/date/test_date_arith.rb index f5ac5bf30b..96622ba065 100644 --- a/test/date/test_date_arith.rb +++ b/test/date/test_date_arith.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'test/unit' require 'date' diff --git a/test/date/test_date_attr.rb b/test/date/test_date_attr.rb index 3d1b0a2e6e..d3bb9b9d74 100644 --- a/test/date/test_date_attr.rb +++ b/test/date/test_date_attr.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'test/unit' require 'date' diff --git a/test/date/test_date_base.rb b/test/date/test_date_base.rb index 06fec19e52..8d53adfc8e 100644 --- a/test/date/test_date_base.rb +++ b/test/date/test_date_base.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'test/unit' require 'date' diff --git a/test/date/test_date_compat.rb b/test/date/test_date_compat.rb index 1bd30b5f80..316f8c0298 100644 --- a/test/date/test_date_compat.rb +++ b/test/date/test_date_compat.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'test/unit' require 'date' diff --git a/test/date/test_date_conv.rb b/test/date/test_date_conv.rb index 3729476314..5c295daba6 100644 --- a/test/date/test_date_conv.rb +++ b/test/date/test_date_conv.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'test/unit' require 'date' diff --git a/test/date/test_date_marshal.rb b/test/date/test_date_marshal.rb index 27ae1e9004..10e396b71b 100644 --- a/test/date/test_date_marshal.rb +++ b/test/date/test_date_marshal.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'test/unit' require 'date' diff --git a/test/date/test_date_new.rb b/test/date/test_date_new.rb index 80ecbc204e..2a015bf364 100644 --- a/test/date/test_date_new.rb +++ b/test/date/test_date_new.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'test/unit' require 'date' diff --git a/test/date/test_date_parse.rb b/test/date/test_date_parse.rb index d980674591..ac0eb85ca7 100644 --- a/test/date/test_date_parse.rb +++ b/test/date/test_date_parse.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'test/unit' require 'date' diff --git a/test/date/test_date_strftime.rb b/test/date/test_date_strftime.rb index 1c0f9b11b4..a33eaa340f 100644 --- a/test/date/test_date_strftime.rb +++ b/test/date/test_date_strftime.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'test/unit' require 'date' diff --git a/test/date/test_date_strptime.rb b/test/date/test_date_strptime.rb index 15fdc949f5..bf3002a24a 100644 --- a/test/date/test_date_strptime.rb +++ b/test/date/test_date_strptime.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'test/unit' require 'date' diff --git a/test/date/test_switch_hitter.rb b/test/date/test_switch_hitter.rb index 931d736edf..bfd0b8efa5 100644 --- a/test/date/test_switch_hitter.rb +++ b/test/date/test_switch_hitter.rb @@ -1,4 +1,4 @@ -# frozen_string_literal: false +# frozen_string_literal: true require 'test/unit' require 'date' @@ -577,29 +577,29 @@ class TestSH < Test::Unit::TestCase def test_taint h = Date._strptime('15:43+09:00', '%R%z') assert_equal(false, h[:zone].tainted?) - h = Date._strptime('15:43+09:00'.taint, '%R%z') + h = Date._strptime('15:43+09:00'.dup.taint, '%R%z') assert_equal(true, h[:zone].tainted?) h = Date._strptime('1;1/0', '%d') assert_equal(false, h[:leftover].tainted?) - h = Date._strptime('1;1/0'.taint, '%d') + h = Date._strptime('1;1/0'.dup.taint, '%d') assert_equal(true, h[:leftover].tainted?) h = Date._parse('15:43+09:00') assert_equal(false, h[:zone].tainted?) - h = Date._parse('15:43+09:00'.taint) + h = Date._parse('15:43+09:00'.dup.taint) assert_equal(true, h[:zone].tainted?) s = Date.today.strftime('new 105') assert_equal(false, s.tainted?) - s = Date.today.strftime('new 105'.taint) + s = Date.today.strftime('new 105'.dup.taint) assert_equal(true, s.tainted?) - s = Date.today.strftime("new \000 105".taint) + s = Date.today.strftime("new \000 105".dup.taint) assert_equal(true, s.tainted?) s = DateTime.now.strftime('super $record') assert_equal(false, s.tainted?) - s = DateTime.now.strftime('super $record'.taint) + s = DateTime.now.strftime('super $record'.dup.taint) assert_equal(true, s.tainted?) end @@ -617,29 +617,29 @@ class TestSH < Test::Unit::TestCase assert_equal(Encoding::US_ASCII, s.encoding) if s end - h = Date._strptime('15:43+09:00'.force_encoding('euc-jp'), '%R%z') + h = Date._strptime('15:43+09:00'.dup.force_encoding('euc-jp'), '%R%z') assert_equal(Encoding::EUC_JP, h[:zone].encoding) - h = Date._strptime('15:43+09:00'.force_encoding('ascii-8bit'), '%R%z') + h = Date._strptime('15:43+09:00'.dup.force_encoding('ascii-8bit'), '%R%z') assert_equal(Encoding::ASCII_8BIT, h[:zone].encoding) - h = Date._strptime('1;1/0'.force_encoding('euc-jp'), '%d') + h = Date._strptime('1;1/0'.dup.force_encoding('euc-jp'), '%d') assert_equal(Encoding::EUC_JP, h[:leftover].encoding) - h = Date._strptime('1;1/0'.force_encoding('ascii-8bit'), '%d') + h = Date._strptime('1;1/0'.dup.force_encoding('ascii-8bit'), '%d') assert_equal(Encoding::ASCII_8BIT, h[:leftover].encoding) - h = Date._parse('15:43+09:00'.force_encoding('euc-jp')) + h = Date._parse('15:43+09:00'.dup.force_encoding('euc-jp')) assert_equal(Encoding::EUC_JP, h[:zone].encoding) - h = Date._parse('15:43+09:00'.force_encoding('ascii-8bit')) + h = Date._parse('15:43+09:00'.dup.force_encoding('ascii-8bit')) assert_equal(Encoding::ASCII_8BIT, h[:zone].encoding) - s = Date.today.strftime('new 105'.force_encoding('euc-jp')) + s = Date.today.strftime('new 105'.dup.force_encoding('euc-jp')) assert_equal(Encoding::EUC_JP, s.encoding) - s = Date.today.strftime('new 105'.force_encoding('ascii-8bit')) + s = Date.today.strftime('new 105'.dup.force_encoding('ascii-8bit')) assert_equal(Encoding::ASCII_8BIT, s.encoding) - s = DateTime.now.strftime('super $record'.force_encoding('euc-jp')) + s = DateTime.now.strftime('super $record'.dup.force_encoding('euc-jp')) assert_equal(Encoding::EUC_JP, s.encoding) - s = DateTime.now.strftime('super $record'.force_encoding('ascii-8bit')) + s = DateTime.now.strftime('super $record'.dup.force_encoding('ascii-8bit')) assert_equal(Encoding::ASCII_8BIT, s.encoding) end