Decode hexadecimal-encoded literals in order to be frozen string literals friendly (#31004).

Patch by Yuichi HARADA.


git-svn-id: http://svn.redmine.org/redmine/trunk@17991 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Go MAEDA
2019-03-19 15:43:55 +00:00
parent 7d2f10ccac
commit 26509e7f4c
31 changed files with 143 additions and 218 deletions

View File

@@ -27,9 +27,6 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
REPOSITORY_PATH = Rails.root.join('tmp/test/mercurial_repository').to_s
NUM_REV = 34
CHAR_1_HEX = "\xc3\x9c".force_encoding('UTF-8')
BRANCH_CHAR_1 = "branch-#{CHAR_1_HEX}-01".force_encoding('UTF-8')
def setup
User.current = nil
@project = Project.find(3)
@@ -54,7 +51,6 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
def test_blank_path_to_repository_error_message_fr
set_language_if_valid 'fr'
str = "Chemin du d\xc3\xa9p\xc3\xb4t doit \xc3\xaatre renseign\xc3\xa9(e)".force_encoding('UTF-8')
repo = Repository::Mercurial.new(
:project => @project,
:url => "",
@@ -62,7 +58,7 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
:path_encoding => ''
)
assert !repo.save
assert_include str, repo.errors.full_messages
assert_include 'Chemin du dépôt doit être renseigné(e)', repo.errors.full_messages
end
if File.directory?(REPOSITORY_PATH)
@@ -356,11 +352,11 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
assert_equal NUM_REV, @repository.changesets.count
if @repository.scm.class.client_version_above?([1, 6])
changesets = @repository.latest_changesets('', BRANCH_CHAR_1)
changesets = @repository.latest_changesets('', 'branch-Ü-01')
assert_equal %w|27 26|, changesets.collect(&:revision)
end
changesets = @repository.latest_changesets("latin-1-dir/test-#{CHAR_1_HEX}-subdir", BRANCH_CHAR_1)
changesets = @repository.latest_changesets('latin-1-dir/test-Ü-subdir', 'branch-Ü-01')
assert_equal %w|27|, changesets.collect(&:revision)
end
@@ -423,8 +419,8 @@ class RepositoryMercurialTest < ActiveSupport::TestCase
scmid3 = scmid_for_assert(hex3, is_short_scmid)
assert_equal 1, c3.size
assert_equal 'A', c3[0].action
assert_equal "/latin-1-dir/test-#{CHAR_1_HEX}-1.txt", c3[0].path
assert_equal "/latin-1-dir/test-#{CHAR_1_HEX}.txt", c3[0].from_path
assert_equal '/latin-1-dir/test-Ü-1.txt', c3[0].path
assert_equal '/latin-1-dir/test-Ü.txt', c3[0].from_path
assert_equal scmid3, c3[0].from_revision
end
private :assert_copied_files