App-Fetchware

 view release on metacpan or  search on metacpan

t/App-FetchwareX-HTMLPageSync.t  view on Meta::CPAN


    # Have Expect print an example URL.
    expect_send('/tmp/somedir/that/doesntexist/somewhereelse',
        'check get_destination_directory() sent answer.');

    expect_quit();
};


subtest 'test HTMLPageSync new() helper ask_about_keep_destination_directory' => sub {
    skip_all_unless_release_testing();

    plan(skip_all => 'Optional Test::Expect testing module not installed.')
        unless eval {require Test::Expect; Test::Expect->import(); 1;};

    # Have Expect tell me what it's doing for easier debugging.
    #$Expect::Exp_Internal = 1;

    # Test saying n.
    expect_run(
        command => 't/App-FetchwareX-HTMLPageSync-new-ask_about_keep_destination_directory',
        prompt => [-re => qr/: |\? /],
        quit => "\cC"
    );

    # First test that the command produced the correct outout.
    expect_like(qr/By default, HTMLPageSync deletes your destination_directory when you uninstall/,
        'checked get_destination_directory() received correct prompt');

    # Have Expect print an example URL.
    expect_send('n',
        'check get_destination_directory() sent answer.');

    expect_quit();

    # Test saying y.

    expect_run(
        command => 't/App-FetchwareX-HTMLPageSync-new-ask_about_keep_destination_directory',
        prompt => [-re => qr/: |\? /],
        quit => "\cC"
    );

    # First test that the command produced the correct outout.
    expect_like(qr/By default, HTMLPageSync deletes your destination_directory when you uninstall/,
        'checked get_destination_directory() received correct prompt');

    # Have Expect print an example URL.
    expect_send('y',
        'check get_destination_directory() sent answer.');

    expect_quit();
};



##BROKEN####TEST### t/App-FetchwareX-HTMLPageSync-new works great at testing new(), but for some
##BROKEN####TEST### reason I can't figure out Expect screws up  this longer test of new() just as
##BROKEN####TEST### it screws it my Expect test for App::Fetchware's new(). So, this test is being
##BROKEN####TEST### commented out too. Consider reating a Test::IO::React, but IO::React has had
##BROKEN####TEST### no new releases for like a decade, so its either unmaintainted and broken, or
##BROKEN####TEST### perhaps unmaintainted, and still works. Don't know...
##BROKEN####TEST##subtest 'test HTMLPageSync new() success' => sub {
##BROKEN####TEST##    skip_all_unless_release_testing();
##BROKEN####TEST##
##BROKEN####TEST##    plan(skip_all => 'Optional Test::Expect testing module not installed.')
##BROKEN####TEST##        unless eval {require Test::Expect; Test::Expect->import(); 1;};
##BROKEN####TEST##
##BROKEN####TEST##    # Have Expect tell me what it's doing for easier debugging.
##BROKEN####TEST##    $Expect::Exp_Internal = 1;
##BROKEN####TEST##
##BROKEN####TEST##    # Test saying n.
##BROKEN####TEST##    expect_run(
##BROKEN####TEST##        command => 't/App-FetchwareX-HTMLPageSync-new',
##BROKEN####TEST##        prompt => [-re => qr/: |\? /],
##BROKEN####TEST##        quit => "\cC"
##BROKEN####TEST##    );
##BROKEN####TEST##
##BROKEN####TEST##    # First test that the command produced the correct outout.
##BROKEN####TEST##    expect_like(qr/HTMLPageSync's new command is not as sophistocated as Fetchware's. Unless you/,
##BROKEN####TEST##        'checked new() received correct prompt');
##BROKEN####TEST##    # Have Expect print an example URL.
##BROKEN####TEST##    expect_send('test',
##BROKEN####TEST##        'check new() sent answer.');
##BROKEN####TEST##
##BROKEN####TEST##    # First test that the command produced the correct outout.
##BROKEN####TEST##    expect_like(qr/Fetchware's heart and soul is its html_page_url. This is the configuration option/,
##BROKEN####TEST##        'checked new() received correct prompt');
##BROKEN####TEST##    # Have Expect print an example URL.
##BROKEN####TEST##    expect_send('http://test.test/test',
##BROKEN####TEST##        'check new() sent answer.');
##BROKEN####TEST##
##BROKEN####TEST##    # First test that the command produced the correct outout.
##BROKEN####TEST##    expect_like(qr/destination_directory is the directory on your computer where you want the files/,
##BROKEN####TEST##        'checked new() received correct prompt');
##BROKEN####TEST##    # Have Expect print an example URL.
##BROKEN####TEST##    expect_send('/tmp',
##BROKEN####TEST##        'check new() sent answer.');
##BROKEN####TEST##
##BROKEN####TEST##    # First test that the command produced the correct outout.
##BROKEN####TEST##    expect_like(qr/By default, HTMLPageSync deletes your destination_directory when you uninstall/,
##BROKEN####TEST##        'checked new() received correct prompt');
##BROKEN####TEST##    # Have Expect print an example URL.
##BROKEN####TEST##    expect_send('Y',
##BROKEN####TEST##        'check new() sent answer.');
##BROKEN####TEST##
##BROKEN####TEST##    # First test that the command produced the correct outout.
##BROKEN####TEST##    expect_like(qr/Fetchware has many different configuration options that allow you to control its/,
##BROKEN####TEST##        'checked new() received correct prompt');
##BROKEN####TEST##    # Have Expect print an example URL.
##BROKEN####TEST##    expect_send('N',
##BROKEN####TEST##        'check new() sent answer.');
##BROKEN####TEST##
##BROKEN####TEST##    # First test that the command produced the correct outout.
##BROKEN####TEST##    expect_like(qr/Fetchware has now asked you all of the needed questions to determine what it/,
##BROKEN####TEST##        'checked new() received correct prompt');
##BROKEN####TEST##    # Have Expect print an example URL.
##BROKEN####TEST##    expect_send('N',
##BROKEN####TEST##        'check new() sent answer.');
##BROKEN####TEST##
##BROKEN####TEST##    expect_quit();
##BROKEN####TEST##};



( run in 0.586 second using v1.01-cache-2.11-cpan-39bf76dae61 )