Sha256: 614f7167f3272a2f5bb23b268a3cabcd5b35c0bef88020b8b5d79e92e293e402

Contents?: true

Size: 601 Bytes

Versions: 4

Compression:

Stored size: 601 Bytes

Contents

require File.expand_path(__FILE__).sub(%r(/test/.*), '/test/test_helper.rb')
require File.expand_path(__FILE__).sub(%r(.*/test/), '').sub(/test_(.*)\.rb/,'\1')

require 'scout/tsv'

class TestClass < Test::Unit::TestCase

  def test_sort_by
    content =<<-EOF
#ID ValueA ValueB Comment
row1 a B c
row2 A b C
    EOF

    TmpFile.with_file(content) do |filename|
      tsv = TSV.open(File.open(filename), :type => :list, :sep => /\s/)
      assert_equal %w(row2 row1), tsv.sort_by("ValueA").collect{|k,v| k}
      assert_equal %w(row1 row2), tsv.sort_by("ValueB").collect{|k,v| k}
    end
  end

end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
scout-gear-10.4.0 test/scout/tsv/util/test_sort.rb
scout-gear-10.3.0 test/scout/tsv/util/test_sort.rb
scout-gear-10.2.0 test/scout/tsv/util/test_sort.rb
scout-gear-10.1.0 test/scout/tsv/util/test_sort.rb