Source

Kephra / t / 620-keymap.t

Full commit
#!usr/bin/perl

# making local lib favoured
BEGIN { unshift @INC, -d 't' ? 'lib' : '../lib' }

package probe;
use Test::More tests => 1;
use Test::NoWarnings;

#use Wx;
#use Kephra::App::Util;
#use Kephra::KeyMap;

#sub one     { 1 }
#sub true    { 'true' }
#sub color   { Kephra::App::Util::create_color("blue") }
#sub channel { $_[0] }
#
#
#eval { Kephra::CommandList::register_cmd_namespace('test') };
#is($@, '', 'registered cmd namespace');
#
#eval { Kephra::CommandList::register_switch_var('color') };
#is($@, '', 'registered package switch var');
#
#eval { Kephra::CommandList::register_switch_var({ '$color' => 'color'}) };
#is($@, '', 'registered named switch var');
#
#eval { Kephra::CommandList::register_cmd({
		#'test-one' => {sub => 'probe::one', label => 'one'},
		    #'-true'=> {sub => 'true', label => 'true'},
		    #'-blue'=> {sub => '$_->IsOk', label => 'blue', help => 'help'},
		    #'-gc'=>   {sub => '$color->IsOk', label => 'gc'},
		    #'-chan'=> {sub => 'channel', label => 'channel', parameter => 4},
#})};
#is($@, '', 'registered command');
#
#eval { Kephra::CommandList::init() };
#is($@, '', 'initialized command list');
#
#
#my $data = Kephra::CommandList::cmd_all_properties('test-one');
#is(ref $data, 'HASH', 'command entry created');
#is($data->{'label'}, 'one', 'command data stored');
#is( Kephra::CommandList::run_cmd('test-one'), 1, 'run command');
#
#my $data = Kephra::CommandList::cmd_all_properties('test-true');
#is(ref $data, 'HASH', 'command ID prefix completion');
#is( Kephra::CommandList::run_cmd('test-true'), 'true', 'sub prefix completion (module name)');
#is( Kephra::CommandList::run_cmd('test-blue'), 1, 'package switch var substitution');
#is( Kephra::CommandList::run_cmd('test-gc'), 1, 'named switch var substitution');
#is( Kephra::CommandList::run_cmd('test-chan'), 4, 'parameter insertion');


exit(0);