File: encoding_test.rb

package info (click to toggle)
ruby-redis 5.4.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,168 kB
  • sloc: ruby: 11,501; makefile: 117; sh: 24
file content (19 lines) | stat: -rw-r--r-- 430 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# frozen_string_literal: true

require "helper"

class TestEncoding < Minitest::Test
  include Helper::Client

  def test_returns_properly_encoded_strings
    r.set "foo", "שלום"

    assert_equal "Shalom שלום", "Shalom #{r.get('foo')}"

    refute_predicate "\xFF", :valid_encoding?
    r.set("bar", "\xFF")
    bytes = r.get("bar")
    assert_equal "\xFF".b, bytes
    assert_predicate bytes, :valid_encoding?
  end
end