App-Critique

 view release on metacpan or  search on metacpan

t/060-clean.t  view on Meta::CPAN

    # warn '-' x 80;
    # warn $err;
    # warn '-' x 80;
};

subtest '... testing collect' => sub {

    my ($out, $err) = App::Critique::Tester::test(
        [
            collect => (
                '-v',
                '--git-work-tree', $work_tree,
            )
        ],
        [
            qr/Session file loaded/,
            qr/Collected 7 perl file\(s\) for critique/,
            qr/Including bin\/my-app/,
            qr/Including lib\/My\/Test\/WithoutViolations\.pm/,
            qr/Including lib\/My\/Test\/WithViolations\.pm/,
            qr/Including root\/app\.psgi/,
            qr/Including share\/debug\.pl/,
            qr/Including t\/000-test-with-violations\.t/,
            qr/Including t\/001-test-without-violations\.t/,
            qr/Sucessfully added 7 file\(s\)/,
            qr/Session file stored successfully/,
            qr/\.critique\/$work_base\/master\/session\.json/,
        ],
        [
            qr/Unable to load session file/,
            qr/Unable to store session file/,
            qr/Shuffling file list/,
            qr/\[dry run\]/,
        ]
    );

    # warn '-' x 80;
    # warn $out;
    # warn '-' x 80;
    # warn $err;
    # warn '-' x 80;
};

Path::Tiny::path( $work_tree )->child('lib')->remove_tree;

subtest '... testing clean' => sub {

    my ($out, $err) = App::Critique::Tester::test(
        [
            clean => (
                '-v',
                '--git-work-tree', $work_tree,
            )
        ],
        [
            qr/Session file loaded/,
            qr/Reviewing 7 file\(s\)/,
            qr/Found 2 removed file\(s\)/,
            qr/$work_tree\/lib\/My\/Test\/WithoutViolations\.pm/,
            qr/$work_tree\/lib\/My\/Test\/WithViolations\.pm/,
            qr/Sucessfully updated list of 5 file\(s\)/,
        ],
        [
            qr/Unable to load session file/,
            qr/Unable to store session file/,
        ]
    );

    # warn '-' x 80;
    # warn $out;
    # warn '-' x 80;
    # warn $err;
    # warn '-' x 80;
};


App::Critique::Tester::teardown_test_repo( $test_repo );

done_testing;



( run in 1.938 second using v1.01-cache-2.11-cpan-5a3173703d6 )