Skip to content

Commit

Permalink
remove invalid UTF-8 byte seqeunce tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ggmichaelgo committed Apr 12, 2024
1 parent 39eb562 commit 305531b
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 39 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ end

gemspec

gem "liquid", github: "Shopify/liquid", ref: "master"
gem "liquid", github: "Shopify/liquid", ref: "main"

group :test do
gem "base64", require: false # for older rubocop on Ruby 3.4
Expand Down
38 changes: 0 additions & 38 deletions test/unit/variable_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -286,44 +286,6 @@ def test_encoding_error_message_with_multi_byte_characters
)
end

def test_invalid_utf8_sequence
# 2 byte character with 1 byte missing
exc = assert_raises(ArgumentError) do
variable_strict_parse("\xC0")
end
assert_equal("invalid byte sequence in UTF-8", exc.message)

# 3 byte character with 1 byte missing
exc = assert_raises(ArgumentError) do
variable_strict_parse("\xE0\x01")
end
assert_equal("invalid byte sequence in UTF-8", exc.message)

# 3 byte character with 2 byte missing
exc = assert_raises(ArgumentError) do
variable_strict_parse("\xE0")
end
assert_equal("invalid byte sequence in UTF-8", exc.message)

# 4 byte character with 1 byte missing
exc = assert_raises(ArgumentError) do
variable_strict_parse("\xF0\x01\x01")
end
assert_equal("invalid byte sequence in UTF-8", exc.message)

# 4 byte character with 2 byte missing
exc = assert_raises(ArgumentError) do
variable_strict_parse("\xF0\x01")
end
assert_equal("invalid byte sequence in UTF-8", exc.message)

# 4 byte character with 3 byte missing
exc = assert_raises(ArgumentError) do
variable_strict_parse("\xF0")
end
assert_equal("invalid byte sequence in UTF-8", exc.message)
end

private

def variable_strict_parse(markup)
Expand Down

0 comments on commit 305531b

Please sign in to comment.