Sha256: 2f93731bfe579df9e1f29a3def8322c9d7ae68f9ea7d0bdbd960ca246acecccf
Contents?: true
Size: 1.33 KB
Versions: 6
Compression:
Stored size: 1.33 KB
Contents
#!/usr/bin/env ruby require 'test/unit' require_relative '../../processor' require_relative '../../app/mock' class TestCmdProcessorLoadCmds < Test::Unit::TestCase def setup @proc = Trepan::CmdProcessor.new(Trepan::MockCore.new()) @proc.instance_variable_set('@settings', {}) end # See that we have can load up commands def test_basic @proc.load_cmds_initialize assert_equal(false, @proc.commands.empty?) assert_equal(false, @proc.aliases.empty?) end def test_complete assert_equal(%w(debug delete directory disable disassemble display down), @proc.complete('d', 'd'), "Failed completion of 'd' commands") assert_equal(['debug', 'different', 'directories'], @proc.complete('sho d', 'd'), "Failed completion of 'sho d' subcommands") $errors = [] end def test_run_cmd $errors = [] def @proc.errmsg(mess) $errors << mess end def test_it(size, *args) @proc.run_cmd(*args) assert_equal(size, $errors.size, $errors) end test_it(1, 'foo') test_it(2, []) test_it(3, ['list', 5]) # See that we got different error messages assert_not_equal($errors[0], $errors[1], $errors) assert_not_equal($errors[1], $errors[2], $errors) assert_not_equal($errors[2], $errors[0], $errors) end end
Version data entries
6 entries across 6 versions & 1 rubygems