Sha256: 6136a2a5ee9cdf8691914bbd1dfdbeb5985c71032a10a33a913120b9f9d7d52f

Contents?: true

Size: 1.08 KB

Versions: 4

Compression:

Stored size: 1.08 KB

Contents

#!/usr/bin/env ruby
require 'test/unit'
require 'rubygems'; require 'require_relative'
require_relative '../../processor/command/base/cmd'

class Trepan
  class Command::Test < Trepan::Command
    NAME = 'test'
    CATEGORY = 'testcategory'
    completion %w(a aa ab ba aac)
  end
end

class TestBaseCommand < Test::Unit::TestCase

  class MockCmdProcessor
    # The below functions aren't tested/called, but they are the
    # methods required by a command and are placeholders for when we
    # do start testing.
    def initialize(dbgr)
    end
    def confirm(message, default)
      p ['confirm: ', message, default]
    end
    def errmsg(message, opts)
      p ['err:', message, opts]
    end
    def msg(message, opts)
      p [message, opts]
    end
    def msg_nocr(message, opts)
      p ['nocr: ', message, opts]
    end
    def section(message, opts)
      p ['section: ', message, opts]
    end
  end

  def setup
    @proc = MockCmdProcessor.new(nil)
    @cmd = Trepan::Command::Test.new(@proc)
  end

  def test_base_completion
    assert_equal(%w(aa aac), @cmd.complete('aa'))
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rbx-trepanning-0.0.8-universal-rubinius-1.2 test/unit/test-base-cmd.rb
rbx-trepanning-0.0.7-universal-rubinius-1.2 test/unit/test-base-cmd.rb
rbx-trepanning-0.0.6-universal-rubinius-1.2 test/unit/test-base-cmd.rb
rbx-trepanning-0.0.5-universal-rubinius-1.2.1 test/unit/test-base-cmd.rb