Sha256: 382146e3366350df90fd83bcfb59059bdcbbeaab97536f7dd59a69c0df7c4991

Contents?: true

Size: 923 Bytes

Versions: 36

Compression:

Stored size: 923 Bytes

Contents

require_relative '../test_helper'

module OhlohScm::Parsers
  class StringEncoderCommandLineTest < OhlohScm::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

36 entries across 36 versions & 1 rubygems

Version Path
ohloh_scm-2.2.13 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.2.12 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.2.11 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.2.10 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.2.9 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.2.8 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.2.7 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.2.6 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.2.5 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.2.4 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.2.3 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.2.2 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.2.1 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.2.0 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.1.0 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.0.1 test/unit/string_encoder_command_line_test.rb