summaryrefslogtreecommitdiff
path: root/test/option_test.rb
diff options
context:
space:
mode:
authorLee Jarvis <lee@jarvis.co>2011-04-19 21:17:39 +0100
committerLee Jarvis <lee@jarvis.co>2011-04-19 21:18:23 +0100
commit15dd3de0aed8be6b789ec2e8b33f5dab74e809f5 (patch)
treef081ba9e245d178695351e69e068debcd0a07e43 /test/option_test.rb
parenta44ef2979d49ac1723b118526233ffc8950d5bd9 (diff)
downloadslop-15dd3de0aed8be6b789ec2e8b33f5dab74e809f5.tar.gz
allow :help to accept an optional string to append to the help
on :n, :name, 'Your name', true, :help => '<NAME HERE>' ' -n, --name <NAME HERE> Your name'
Diffstat (limited to 'test/option_test.rb')
-rw-r--r--test/option_test.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/option_test.rb b/test/option_test.rb
index 87abecc..8e9aa25 100644
--- a/test/option_test.rb
+++ b/test/option_test.rb
@@ -116,6 +116,12 @@ class OptionTest < TestCase
refute slop.help.include?('foo')
end
+ test 'appends a help string with :help => "string"' do
+ slop = Slop.new
+ slop.on :n, :name, 'Your name', true, :help => '<YOUR NAME HERE>'
+ assert_equal ' -n, --name <YOUR NAME HERE> Your name', slop.options[:name].to_s
+ end
+
test 'argument matching' do
slop = Slop.new
slop.on :f, :foo, true, :match => /^h/