Sha256: 52bcce42510f0daec4f575a404797afcfaf3a20e22759cb5bfc3e4c6334f7498

Contents?: true

Size: 622 Bytes

Versions: 102

Compression:

Stored size: 622 Bytes

Contents

require File.expand_path(File.dirname(__FILE__) + '/../../test_helper')
require 'rbbt/tsv'
require 'rbbt/tsv/util'
require 'rbbt/util/tmpfile'
require 'test/unit'

class TestTSVUtil < Test::Unit::TestCase

  def test_field_counts
   content =<<-EOF
#Id    ValueA    ValueB    OtherID
row1    a|aa|aaa    b    Id1|Id2
row2    A    B    Id3
    EOF

    TmpFile.with_file(content) do |filename|
      tsv = TSV.open(filename, :sep => /\s+/)

      assert_equal 2, TSV.field_match_counts(tsv, ["a","A","a","b","Id3"])["ValueA"]
      assert_equal nil, TSV.field_match_counts(tsv, ["ValueA"])["ValueA"]

    end
  
  end

end

Version data entries

102 entries across 102 versions & 1 rubygems

Version Path
rbbt-util-5.0.0 test/rbbt/tsv/test_util.rb
rbbt-util-4.4.0 test/rbbt/tsv/test_util.rb