Implement basic CLI usage help
This commit is contained in:
11
features/cli/usage.feature
Normal file
11
features/cli/usage.feature
Normal file
@@ -0,0 +1,11 @@
|
||||
Feature: CLI usage
|
||||
|
||||
Scenario: prints the usage when unknown option switch is given
|
||||
When I run uhwm with option --unknown-option
|
||||
Then the exit status must be 64
|
||||
And the output must contain exactly the usage
|
||||
|
||||
Scenario: prints the help when -h option is given
|
||||
When I run uhwm with option -h
|
||||
Then the exit status must be 0
|
||||
And the output must contain exactly the usage
|
8
features/steps/output_steps.rb
Normal file
8
features/steps/output_steps.rb
Normal file
@@ -0,0 +1,8 @@
|
||||
Then /^the output must contain exactly the usage$/ do
|
||||
assert_exact_output <<-eoh, all_output
|
||||
Usage: uhwm [options]
|
||||
|
||||
options:
|
||||
-h, --help print this message
|
||||
eoh
|
||||
end
|
@@ -1,4 +1,17 @@
|
||||
When /^I start uhwm$/ do
|
||||
@process = run 'uhwm'
|
||||
@interactive = @process
|
||||
def uhwm_run options = nil
|
||||
command = %w[uhwm]
|
||||
command << options if options
|
||||
@interactive = @process = run command.join ' '
|
||||
end
|
||||
|
||||
When /^I start uhwm$/ do
|
||||
uhwm_run
|
||||
end
|
||||
|
||||
When /^I run uhwm with options? (-.+)$/ do |options|
|
||||
uhwm_run options
|
||||
end
|
||||
|
||||
Then /^the exit status must be (\d+)$/ do |exit_status|
|
||||
assert_exit_status exit_status.to_i
|
||||
end
|
||||
|
Reference in New Issue
Block a user