App-Fetchware
view release on metacpan or search on metacpan
t/App-Fetchware-new.t view on Meta::CPAN
expect_run(
command => 't/App-Fetchware-new-get_filter_option',
prompt => [-re => qr/: |\? /],
quit => "\cC" # CTRL-C
);
expect_like(qr/Analyzing the lookup_url you provided to determine if fetchware/,
'checked get_filter_option() received correct filter prompt');
expect_send('httpd-2.2',
'check get_filter_option() provided filter.');
expect_quit();
};
subtest 'test edit_manually() success' => sub {
# Create test Term::UI object.
my $term = Term::ReadLine->new('fetchware');
# Need a $fetchwarefile object to test edit_manually().
my $fetchwarefile = App::Fetchware::Fetchwarefile->new(
header => <<EOF,
use App::Fetchware;
# Auto generated by fetchware's new command.
# However, feel free to edit this file if fetchware's new command's
# autoconfiguration is not enough.
#
# Please look up fetchware's documentation of its configuration file syntax at
# perldoc App::Fetchware, and only if its configuration file syntax is not
# malleable enough for your application should you resort to customizing
# fetchware's behavior. For extra flexible customization see perldoc
# App::Fetchware.
EOF
descriptions => {
program => <<EOD,
program simply names the program the Fetchwarefile is responsible for
downloading, building, and installing.
EOD
temp_dir => <<EOD,
temp_dir specifies what temporary directory fetchware will use to download and
build this program.
EOD
mirror => <<EOD,
The mirror configuration option provides fetchware with alternate servers to
try to download this program from. This option is used when the server
specified in the url options in this file is unavailable or times out.
EOD
}
);
$fetchwarefile = edit_manually($term, $fetchwarefile);
isa_ok($fetchwarefile, 'App::Fetchware::Fetchwarefile',
'Test Fetchwarefile');
};
##TODO#####BUGALERT### The code below that tests cmd_new() has *not* been updated yet to
##TODO###the Fetchware refactor where cmd_new()'s behavior was moved into App::Fetchware
##TODO###as the new API subroutines new() and new_install(). So, if you wish to test the
##TODO###code below, you'll have to fix it up to work how new() works after the
##TODO###refactor. Also note, the code below has been copied and pasted to become with
##TODO###basis of t/App-Fetchware-new_install.t and even the updated to work with the
##TODO###refactor, t/bin-fetchware-new.t.
##TODO####BROKEN##subtest 'test cmd_new() success' => sub {
##TODO####BROKEN## skip_all_unless_release_testing();
##TODO####BROKEN##
##TODO####BROKEN## plan(skip_all => 'Optional Test::Expect testing module not installed.')
##TODO####BROKEN## unless eval {require Test::Expect; Test::Expect->import(); 1;};
##TODO####BROKEN##
##TODO####BROKEN## # Disable Term::UI's AUTOREPLY for this subtest, because unless I use
##TODO####BROKEN## # something crazy like Test::Expect, this will have to be tested "manually."
##TODO####BROKEN## local $Term::UI::AUTOREPLY = 0;
##TODO####BROKEN## # Fix the "out of orderness" thanks to Test::Builder messing with
##TODO####BROKEN## # STD{OUT,ERR}.
##TODO####BROKEN### local $| = 1;
##TODO####BROKEN##
##TODO####BROKEN## # Have Expect tell me what it's doing for easier debugging.
##TODO####BROKEN## $Expect::Exp_Internal = 1;
##TODO####BROKEN##
##TODO####BROKEN## expect_run(
##TODO####BROKEN## command => 't/bin-fetchware-new-cmd_new',
##TODO####BROKEN### prompt => [-re => qr/((?<!\? \[y\/N\]): |\? )/ms],
##TODO####BROKEN## #prompt => [-re => qr/(\?|:) \[y\/N\] |\? |: /ims],
##TODO####BROKEN### prompt => [-re => qr/((?:\?|:) \[y\/N\]: )|\? |: /i],
##TODO####BROKEN## prompt => [-re => qr/ \[y\/N\]: |\? |: /i],
##TODO####BROKEN### prompt => [-re => qr/\? \n/ims],
##TODO####BROKEN## quit => "\cC"
##TODO####BROKEN## );
##TODO####BROKEN##
##TODO####BROKEN## # Have Expect restart its timeout anytime output is received. Should keep
##TODO####BROKEN## # expect from timeingout while it's waiting for Apache to compile.
##TODO####BROKEN## #my $exp = expect_handle();
##TODO####BROKEN## #$exp->restart_timeout_upon_receive(1);
##TODO####BROKEN##
##TODO####BROKEN## # First test that the command produced the correct outout.
##TODO####BROKEN## expect_like(qr/Fetchware's new command is reasonably sophisticated, and is smart enough to/ms,
##TODO####BROKEN## 'checked cmd_new() received correct name prompt');
##TODO####BROKEN##
##TODO####BROKEN## expect_send('Apache',
##TODO####BROKEN## 'check cmd_new() sent Apache as my name.');
##TODO####BROKEN##
##TODO####BROKEN## expect_like(qr/Fetchware's heart and soul is its lookup_url. This is the configuration option/ms,
##TODO####BROKEN## 'checked cmd_new() received lookup_url prompt.');
##TODO####BROKEN##
##TODO####BROKEN## expect_send("$ENV{FETCHWARE_HTTP_LOOKUP_URL}",
##TODO####BROKEN## 'checked cmd_new() say lookup_url.');
##TODO####BROKEN##
##TODO####BROKEN## expect_like(qr/Fetchware requires you to please provide a mirror. This mirror is required,/ms,
##TODO####BROKEN## 'checked cmd_new() received mirror prompt.');
##TODO####BROKEN##
##TODO####BROKEN## expect_send("$ENV{FETCHWARE_HTTP_MIRROR_URL}",
##TODO####BROKEN## 'checked cmd_new() say mirror.');
##TODO####BROKEN##
##TODO####BROKEN## expect_like(qr/In addition to the one required mirror that you must define in order for/ms,
##TODO####BROKEN## 'checked cmd_new() received more mirrors prompt.');
##TODO####BROKEN##
##TODO####BROKEN## expect_send('N',
##TODO####BROKEN## 'checked cmd_new() say N for more mirrors.');
##TODO####BROKEN##
##TODO####BROKEN## #expect_like(qr!\[y/N\]|gpg digital signatures found. Using gpg verification.!ms,
##TODO####BROKEN## expect_like(qr!.*|gpg digital signatures found. Using gpg verification.!ms,
##TODO####BROKEN## 'checked cmd_new() received filter prompt.');
( run in 1.440 second using v1.01-cache-2.11-cpan-39bf76dae61 )