Sha256: 7def6c6404f8b1488c1658a2bd97672607b8904ee6791710eed0f0750ef2f216

Contents?: true

Size: 802 Bytes

Versions: 2

Compression:

Stored size: 802 Bytes

Contents

#!/usr/bin/env ruby
# -*- coding: binary -*-

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

require 'test/unit'
require 'rex/ui'

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

	def test_stuff
		output   = Rex::Ui::Text::Output::Buffer.new
		pt       = Rex::Ui::Text::ProgressTracker.new(output)

		pt.range = 1..10
	
		assert_equal(1, pt.start)
		assert_equal(10, pt.stop)

		pt.start = 2
		assert_equal(2, pt.start)
		pt.stop = 9
		assert_equal(9, pt.stop)
		assert_equal(2, pt.pos)
		assert_equal('', output.buf)
		assert_equal(3, pt.step)
		assert_equal(4, pt.step("test"))
		assert_equal("[*] 4: test\n", output.buf)
		output.reset
		assert_equal("[-] bad\n", pt.error("bad"))
		output.reset
		assert_equal("[-] fatal: bad\n", pt.abort("bad"))
	end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
librex-0.0.68 lib/rex/ui/text/progress_tracker.rb.ut.rb
librex-0.0.66 lib/rex/ui/text/progress_tracker.rb.ut.rb