Sha256: fa2be8b150424a3e2b5991e6b4de992a0a906e6a44323d645d5769e0d93281cf

Contents?: true

Size: 930 Bytes

Versions: 43

Compression:

Stored size: 930 Bytes

Contents

#!/usr/bin/env ruby

$:.unshift(File.join(File.dirname(__FILE__), '..', '..', '..'))

require 'test/unit'
require 'rex/ui/text/table'

class Rex::Ui::Text::Table::UnitTest < Test::Unit::TestCase

	def new_table(opts = {})
		if (opts['Columns'] == nil)
			opts['Columns'] = 
				[
					'col1',
					'col2',
					'col3'
				]
		end

		tbl = Rex::Ui::Text::Table.new(opts)

		tbl << [ "r1cell1", "r1cell2", "r1cell3" ]
		tbl << [ "r2cell1", "r2cell2", "r2cell3" ]

		return tbl
	end

	def test_basic
		tbl = new_table

		dstr = <<End 
col1     col2     col3     
----     ----     ----     
r1cell1  r1cell2  r1cell3  
r2cell1  r2cell2  r2cell3  
End

		assert_equal(tbl.to_s, dstr)
	end

	def test_indent
		tbl = new_table(
			'Indent' => 4)

		dstr = <<End 
    col1     col2     col3     
    ----     ----     ----     
    r1cell1  r1cell2  r1cell3  
    r2cell1  r2cell2  r2cell3  
End

		assert_equal(tbl.to_s, dstr)
	end

end

Version data entries

43 entries across 43 versions & 1 rubygems

Version Path
librex-0.0.65 lib/rex/ui/text/table.rb.ut.rb
librex-0.0.63 lib/rex/ui/text/table.rb.ut.rb
librex-0.0.54 lib/rex/ui/text/table.rb.ut.rb
librex-0.0.53 lib/rex/ui/text/table.rb.ut.rb
librex-0.0.52 lib/rex/ui/text/table.rb.ut.rb
librex-0.0.51 lib/rex/ui/text/table.rb.ut.rb
librex-0.0.50 lib/rex/ui/text/table.rb.ut.rb
librex-0.0.49 lib/rex/ui/text/table.rb.ut.rb
librex-0.0.48 lib/rex/ui/text/table.rb.ut.rb
librex-0.0.47 lib/rex/ui/text/table.rb.ut.rb
librex-0.0.46 lib/rex/ui/text/table.rb.ut.rb
librex-0.0.44 lib/rex/ui/text/table.rb.ut.rb
librex-0.0.43 lib/rex/ui/text/table.rb.ut.rb
librex-0.0.42 lib/rex/ui/text/table.rb.ut.rb
librex-0.0.41 lib/rex/ui/text/table.rb.ut.rb
librex-0.0.40 lib/rex/ui/text/table.rb.ut.rb
librex-0.0.39 lib/rex/ui/text/table.rb.ut.rb
librex-0.0.38 lib/rex/ui/text/table.rb.ut.rb
librex-0.0.37 lib/rex/ui/text/table.rb.ut.rb
librex-0.0.36 lib/rex/ui/text/table.rb.ut.rb