Sha256: 2e8f5a69c6ebacbc765cace152ab79b8dafa97331b445a12045b62580a479e63

Contents?: true

Size: 918 Bytes

Versions: 1

Compression:

Stored size: 918 Bytes

Contents

require_relative '../test_helper'

module OhlohScm::Parsers
  class StringEncoderCommandLineTest < Scm::Test
    def test_length_of_content_unchanged
      file_path = File.expand_path('../../data/sample-content', __FILE__)
      original_content_length = File.size(file_path)
      original_content_lines = File.readlines(file_path).size

      output = %x[cat #{ file_path } \
        | #{ OhlohScm::Adapters::AbstractAdapter.new.string_encoder } ]

      assert_equal original_content_length, output.length
      assert_equal original_content_lines, output.split("\n").length
    end

    def test_encoding_invalid_characters
      invalid_utf8_word_path =
        File.expand_path('../../data/invalid-utf-word', __FILE__)

      string = %x[cat #{ invalid_utf8_word_path } \
        | #{ OhlohScm::Adapters::AbstractAdapter.new.string_encoder } ]

      assert_equal true, string.valid_encoding?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ohloh_scm-2.0.0 test/unit/string_encoder_command_line_test.rb