sbotools2

Maintenance fork of the original sbotools version 2
git clone git://git.server.ky/slackcoder/sbotools2
Log | Files | Refs | README

02.1-unit-args.t (2140B)


      1 #!/usr/bin/env perl
      2 
      3 use strict;
      4 use warnings;
      5 use Test::More;
      6 use Test::Exit;
      7 use FindBin '$RealBin';
      8 use lib "$RealBin/../SBO-Lib/lib";
      9 use SBO::Lib;
     10 use Capture::Tiny qw/ capture_merged /;
     11 
     12 plan tests => 59;
     13 
     14 sub test_args {
     15 	my $sub = shift;
     16 	my @args = @_;
     17 	subtest "Testing $sub exit status when called with too few arguments", sub {
     18 		plan tests => 2;
     19 
     20 		my $exit;
     21 		my $out = capture_merged { $exit = exit_code { SBO::Lib->can("SBO::Lib::$sub")->(@args); }; };
     22 
     23 		is ($exit, 2, "$sub(@args) exited with 2");
     24 		like ($out, qr!\QA fatal script error has occurred:\E\n\Q$sub\E.*\nExiting\.\n!, "$sub(@args) gave correct output");
     25 	}
     26 }
     27 
     28 test_args $_ for qw/
     29 	rsync_sbo_tree git_sbo_tree check_git_remote get_installed_packages get_inst_names
     30 	get_sbo_location get_sbo_locations is_local get_orig_location get_orig_version
     31 	get_sbo_from_loc get_from_info get_sbo_version get_download_info get_sbo_downloads
     32 	get_filename_from_link verify_distfile get_distfile get_symlink_from_filename
     33 	check_x32 rewrite_slackbuild revert_slackbuild check_distfiles create_symlinks
     34 	get_tmp_extfn perform_sbo do_convertpkg do_slackbuild make_clean make_distclean
     35 	do_upgradepkg get_build_queue merge_queues get_user_group ask_user_group get_opts
     36 	ask_opts user_prompt get_readme_contents
     37 /;
     38 
     39 test_args 'get_from_info', LOCATION => 1;
     40 test_args 'get_from_info', GET => 1;
     41 test_args 'get_sbo_downloads', LOCATION => $0;
     42 test_args 'compute_md5sum', $RealBin;
     43 test_args 'get_symlink_from_filename', $RealBin, 0;
     44 test_args 'perform_sbo', LOCATION => 1;
     45 test_args 'perform_sbo', ARCH => 1;
     46 test_args 'make_clean', SBO => 1;
     47 test_args 'make_clean', SRC => 1;
     48 test_args 'make_clean', VERSION => 1;
     49 test_args 'make_clean', SBO => 1, SRC => 1;
     50 test_args 'make_clean', SBO => 1, VERSION => 1;
     51 test_args 'make_clean', SRC => 1, VERSION => 1;
     52 test_args 'make_distclean', SRC => 1;
     53 test_args 'make_distclean', VERSION => 1;
     54 test_args 'make_distclean', LOCATION => 1;
     55 test_args 'make_distclean', SRC => 1, VERSION => 1;
     56 test_args 'make_distclean', SRC => 1, LOCATION => 1;
     57 test_args 'make_distclean', VERSION => 1, LOCATION => 1;
     58 test_args 'process_sbos', TODO => [];