Skip to content
Browse files

15 passes, but only cuz it's the trivial case

  • Loading branch information...
1 parent 9a4310d commit 276b1d54b0b289f297e75913de370bd3f3f45349 @jettero committed
Showing with 12 additions and 3 deletions.
  1. +12 −3 t/15_parse_for_tab_completion.t
View
15 t/15_parse_for_tab_completion.t
@@ -3,8 +3,16 @@ use common::sense;
use Test;
use lib 'example';
use Term::ReadLine::CLISH;
+use Net::DNS;
-my $parser = Term::ReadLine::CLISH->new->add_namespace("example::cmds")->rebuild_parser->parser;
+$ENV{CLISH_DEBUG} = 1; # this messages up the message capture if it's set
+
+my @output;
+*Term::ReadLine::CLISH::Message::spew = sub { push @output, "@_" };
+
+my $clish = Term::ReadLine::CLISH->new->add_namespace("example::cmds") or die "couldn't make clish";
+ $clish -> rebuild_parser;
+my $parser = $clish->parser or die "couldn't make parser";
my %LINES = (
q => [ "quit" ],
@@ -16,7 +24,8 @@ my %LINES = (
plan tests => 0 + (map { @$_ } values %LINES);
for my $line (keys %LINES) {
- my @options = $parser->parse_for_tab_completion($line);
+ my @options = sort $parser->parse_for_tab_completion($line);
+ my @expect = sort @{ $LINES{$line} };
- warn " options: @options";
+ ok( "@options" => "@expect" );
}

0 comments on commit 276b1d5

Please sign in to comment.
Something went wrong with that request. Please try again.