Changeset 82a6e8b
- Timestamp:
- Jul 27, 2009, 11:23:57 PM (15 years ago)
- Branches:
- master, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 7be5d8b
- Parents:
- b73bcbb
- git-author:
- Nelson Elhage <nelhage@mit.edu> (07/27/09 22:20:40)
- git-committer:
- Nelson Elhage <nelhage@mit.edu> (07/27/09 23:23:57)
- Files:
-
- 1 added
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
t/completion.t
r6e48560 r82a6e8b 118 118 is(BarnOwl::Completion::common_prefix(qw(abc abc)), 'abc'); 119 119 120 ## Test complete_flags 121 122 use BarnOwl::Completion::Util qw(complete_flags); 123 124 # dummy complete_zwrite 125 sub complete_zwrite { 126 my $ctx = shift; 127 return complete_flags($ctx, 128 [qw(-n -C -m)], 129 { 130 "-c" => sub {qw(nelhage nethack sipb help)}, 131 "-i" => sub {qw()}, 132 "-r" => sub {qw(ATHENA.MIT.EDU ZONE.MIT.EDU ANDREW.CMU.EDU)}, 133 "-O" => sub {qw()}, 134 }, 135 sub {qw(nelhage asedeno geofft)}); 136 } 137 138 sub test_complete { 139 my $before = shift; 140 my $after = shift; 141 my $words = shift; 142 143 my $ctx = BarnOwl::Completion::Context->new($before, $after); 144 145 local $Test::Builder::Level = $Test::Builder::Level + 1; 146 147 my @got = complete_zwrite($ctx); 148 is_deeply([sort @got], [sort @$words]); 149 } 150 151 test_complete('zwrite -c ', '', [qw(nelhage nethack sipb help)]); 152 153 test_complete('zwrite -c nelhage', '', [qw(nelhage nethack sipb help)]); 154 155 test_complete('zwrite -c nelhage -i ', '', [qw()]); 156 157 test_complete('zwrite -c nelhage ', '', 158 [qw(-n -C -m -c -i -r -O nelhage asedeno geofft)]); 159 160 test_complete('zwrite -c nelhage ', '-', 161 [qw(-n -C -m -c -i -r -O nelhage asedeno geofft)]); 162 120 163 1; 164
Note: See TracChangeset
for help on using the changeset viewer.