File: 19.find_similar_commands.t

package info (click to toggle)
perlbrew 1.02-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 752 kB
  • sloc: perl: 9,387; makefile: 7; sh: 1
file content (32 lines) | stat: -rw-r--r-- 785 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!perl
use Test2::V0;

use App::perlbrew;
use File::Temp qw( tempdir );

$ENV{PERLBREW_ROOT} = $App::perlbrew::PERLBREW_ROOT = tempdir( CLEANUP => 1 );
$App::perlbrew::PERLBREW_HOME = tempdir( CLEANUP => 1 );

my $app = App::perlbrew->new;
diag join ", ", sort $app->commands;

subtest "exact result", sub {
    my @commands = $app->find_similar_commands( "install" );
    is 0+@commands, 1;
    is $commands[0], "install";
};

subtest "one result", sub {
    my @commands = $app->find_similar_commands( "instali" );
    is 0+@commands, 1;
    is $commands[0], "install";
};

subtest "two result", sub {
    my @commands = $app->find_similar_commands( "install-cpam" );
    is 0+@commands, 2;
    is $commands[0], "install-cpanm";
    is $commands[1], "install-cpm";
};

done_testing;