Sha256: e300fcf5aecf7fe7a841142473e39cc242ca6bf845580da4b3c5ec2bf38b14b0

Contents?: true

Size: 1.17 KB

Versions: 40

Compression:

Stored size: 1.17 KB

Contents

require 'epitools/term'

describe Term do

  it "sizes" do
    width, height = Term.size
    width.class.should == Fixnum
    height.class.should == Fixnum
  end

  it "tables" do
    table = Term::Table[ (1..1000).to_a ]
    #p [:cols, table.num_columns]
    #p [:rows, table.num_rows]
    #puts "columns"
    #puts table.by_columns :border=>true
    #puts "rows"
    #puts table.by_rows 
    puts table.by_rows

    table.by_columns.should_not be_nil
    table.by_rows.should_not be_nil

    table.border = true
    
    table.by_columns.should_not be_nil
    table.by_rows.should_not be_nil

    # Term::Table do |table|
    #   100.times do |n|
    #     table.row do
    #       col "#{n}."
    #       col "A" * rand(10)
    #       col "B" * rand(10)
    #     end
    #   end
    # end

    # Term::Table[
    #   [1,2,3], 
    #   [4,5,6] 
    # ]
    
    table = Term::Table.new
    table.rows = [ [1,2,3], [4,5,6] ]
    table.rows << [1,2,3]
    table.rows << [4,5,6]
    table.add_row [1,2,3,4,5]
  end
  
  it "tables nothing" do
    table = Term::Table.new []
    lambda { table.by_rows }.should_not raise_error
    lambda { table.by_columns }.should_not raise_error
  end
  
end

Version data entries

40 entries across 40 versions & 1 rubygems

Version Path
epitools-0.5.103 spec/term_spec.rb
epitools-0.5.100 spec/term_spec.rb
epitools-0.5.99 spec/term_spec.rb
epitools-0.5.98 spec/term_spec.rb
epitools-0.5.97 spec/term_spec.rb
epitools-0.5.96 spec/term_spec.rb
epitools-0.5.95 spec/term_spec.rb
epitools-0.5.94 spec/term_spec.rb
epitools-0.5.93 spec/term_spec.rb
epitools-0.5.92 spec/term_spec.rb
epitools-0.5.91 spec/term_spec.rb
epitools-0.5.90 spec/term_spec.rb
epitools-0.5.89 spec/term_spec.rb
epitools-0.5.88 spec/term_spec.rb
epitools-0.5.87 spec/term_spec.rb
epitools-0.5.86 spec/term_spec.rb
epitools-0.5.85 spec/term_spec.rb
epitools-0.5.84 spec/term_spec.rb
epitools-0.5.83 spec/term_spec.rb
epitools-0.5.82 spec/term_spec.rb