Skip to content

Commit

Permalink
remote-mediawiki tests: use a more idiomatic dispatch table
Browse files Browse the repository at this point in the history
Change the dispatch table code in test-gitmw.pl to use a hash where
subroutine references are the values. This is more obvious than a hash
where the values are strings we'll use to go searching around in the
symbol table for the function.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
avar authored and gitster committed Sep 21, 2020
1 parent 9ff2958 commit dde66eb
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions contrib/mw-to-git/t/test-gitmw.pl
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,12 @@ sub wiki_upload_file {

wiki_login($wiki_admin, $wiki_admin_pass);

my %functions_to_call = qw(
upload_file wiki_upload_file
get_page wiki_getpage
delete_page wiki_delete_page
edit_page wiki_editpage
getallpagename wiki_getallpagename
my %functions_to_call = (
upload_file => \&wiki_upload_file,
get_page => \&wiki_getpage,
delete_page => \&wiki_delete_page,
edit_page => \&wiki_editpage,
getallpagename => \&wiki_getallpagename,
);
die "$0 ERROR: wrong argument" unless exists $functions_to_call{$fct_to_call};
&{$functions_to_call{$fct_to_call}}(@ARGV);
$functions_to_call{$fct_to_call}->(@ARGV);

0 comments on commit dde66eb

Please sign in to comment.