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.5.1 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.4.14 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.4.13 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.4.12 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.4.11 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.4.10 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.4.9 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.4.8 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.4.7 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.4.6 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.4.5 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.4.4 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.4.3 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.4.1 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.4.0 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.3.5 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.3.4 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.3.2 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.3.1 test/unit/string_encoder_command_line_test.rb
ohloh_scm-2.3.0 test/unit/string_encoder_command_line_test.rb