Sha256: 4f5cf77cdc802ca4fcd5d34cf434937814d0d7d516bb131f933f6a1e81f00c44

Contents?: true

Size: 1.25 KB

Versions: 2

Compression:

Stored size: 1.25 KB

Contents

#!/usr/bin/env ruby
require 'test/unit'

# Test Trepan::CmdProcessor::Default
class TestProcDefault < Test::Unit::TestCase

    DIR = File.dirname(__FILE__)
    DEFAULT_RBFILE = File.join(%W(#{DIR} .. .. processor default.rb))

    def test_maxwidth_setting
        ENV['COLUMNS'] = '50'
        Trepan::CmdProcessor.send(:remove_const, 'DEFAULT_SETTINGS') if
            (defined?(TestProcDefault::Trepan) &&
             Trepan::CmdProcessor.const_defined?('DEFAULT_SETTINGS'))
        load DEFAULT_RBFILE
        assert_equal(50, Trepan::CmdProcessor::DEFAULT_SETTINGS[:maxwidth],
                     'Pick up COLUMNS environment')

        Trepan::CmdProcessor.send(:remove_const, 'DEFAULT_SETTINGS')
        load DEFAULT_RBFILE

        ENV['COLUMNS'] = '0'
        assert_operator(Trepan::CmdProcessor::DEFAULT_SETTINGS[:maxwidth],
                        :>=, 10,
                        'Change too small COLUMNS environment value')

        Trepan::CmdProcessor.send(:remove_const, 'DEFAULT_SETTINGS')
        load DEFAULT_RBFILE

        ENV['COLUMNS'] = 'non-numeric-string'
        assert_operator(Trepan::CmdProcessor::DEFAULT_SETTINGS[:maxwidth],
                        :>=, 10,
                        'Change too small COLUMNS environment value')
    end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
trepanning-2.15.35 test/unit/test-proc-default.rb
trepanning-2.15.33 test/unit/test-proc-default.rb