Browse code

Add acceptance test for --help

Also shorten help to fit 80 characters wide terminal.

John Hawthorn authored on 08/02/2017 02:17:41
Showing 2 changed files

... ...
@@ -15,7 +15,7 @@ static const char *usage_str =
15 15
     " -e, --show-matches=QUERY Output the sorted matches of QUERY\n"
16 16
     " -t, --tty=TTY            Specify file to use as TTY device (default /dev/tty)\n"
17 17
     " -s, --show-scores        Show the scores of each match\n"
18
-    " -j, --workers NUM        Use NUM workers for searching. (default is number of CPU threads)\n"
18
+    " -j, --workers NUM        Use NUM workers for searching. (default is # of CPUs)\n"
19 19
     " -h, --help     Display this help and exit\n"
20 20
     " -v, --version  Output version information and exit\n";
21 21
 
... ...
@@ -228,4 +228,20 @@ class FzyTest < Minitest::Test
228 228
     @tty.send_keys("baz")
229 229
     @tty.assert_matches "foo bar baz"
230 230
   end
231
+
232
+  def test_help
233
+    @tty = TTYtest.new_terminal(%{#{FZY_PATH} --help})
234
+    @tty.assert_matches <<TTY
235
+Usage: fzy [OPTION]...
236
+ -l, --lines=LINES        Specify how many lines of results to show (default 10)
237
+ -p, --prompt=PROMPT      Input prompt (default '> ')
238
+ -q, --query=QUERY        Use QUERY as the initial search string
239
+ -e, --show-matches=QUERY Output the sorted matches of QUERY
240
+ -t, --tty=TTY            Specify file to use as TTY device (default /dev/tty)
241
+ -s, --show-scores        Show the scores of each match
242
+ -j, --workers NUM        Use NUM workers for searching. (default is # of CPUs)
243
+ -h, --help     Display this help and exit
244
+ -v, --version  Output version information and exit
245
+TTY
246
+  end
231 247
 end