Implement verbose mode

This commit is contained in:
Thibault Jouan
2015-04-09 11:17:26 +00:00
parent 404b34acc0
commit 254efe4f74
7 changed files with 64 additions and 11 deletions

View File

@@ -0,0 +1,5 @@
Feature: verbose CLI option
Scenario: raises the logger level to INFO
When I run uhwm with option -v
Then the current output must match /log.+info.+level/i

View File

@@ -1,7 +1,12 @@
def uhwm_wait_output message, timeout: 1
Timeout.timeout(timeout) do
loop do
break if assert_partial_output_interactive message
break if case message
when Regexp
@process.read_stdout =~ message
when String
assert_partial_output_interactive message
end
sleep 0.1
end
end
@@ -15,5 +20,10 @@ Usage: uhwm [options]
options:
-h, --help print this message
-v, --version enable verbose mode
eoh
end
Then /^the current output must match \/([^\/]+)\/([a-z]+)$/ do |pattern, options|
uhwm_wait_output Regexp.new(pattern, options)
end

View File

@@ -1,4 +1,4 @@
def uhwm_run options = nil
def uhwm_run options = '-v'
command = %w[uhwm]
command << options if options
@interactive = @process = run command.join ' '