Sha256: 9be2e9128254fa0471745ab09c9cc71a31d66441a7d1622084478f579ab7c2f1

Contents?: true

Size: 590 Bytes

Versions: 1

Compression:

Stored size: 590 Bytes

Contents

# frozen_string_literal: true

RSpec.describe TTY::File, "#read_to_char" do
  before do
    @saved_verbosity =  $VERBOSE
    @saved_encoding = Encoding.default_external
    $VERBOSE = nil
    Encoding.default_external = Encoding::UTF_8
  end

  after do
    Encoding.default_external = @saved_encoding
    $VERBOSE = @saved_verbosity
  end

  it "reads file up to valid char", unless: RSpec::Support::OS.windows? do
    file = tmp_pathname("binary", "unicode.txt")
    bytes = 4096

    content = TTY::File.read_to_char(file, bytes)

    expect(content.bytesize).to eq(bytes + 2)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tty-file-0.8.0 spec/unit/read_to_char_spec.rb