summaryrefslogtreecommitdiff
path: root/test/slop_test.rb
diff options
context:
space:
mode:
authorLee Jarvis <ljjarvis@gmail.com>2013-03-05 11:50:46 +0000
committerLee Jarvis <ljjarvis@gmail.com>2013-03-05 11:50:46 +0000
commit7deec9db58148ae47ce970108f0f008e2fbb2d2e (patch)
tree4cd4da48f64f13da2ac9a65c7ee6f9ff95baa156 /test/slop_test.rb
parent033d7a3b35dbc221b120cda1ad5f0fb839342aeb (diff)
downloadslop-7deec9db58148ae47ce970108f0f008e2fbb2d2e.tar.gz
disable run callback when help option is used
closes #106
Diffstat (limited to 'test/slop_test.rb')
-rw-r--r--test/slop_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/slop_test.rb b/test/slop_test.rb
index ecd1932..a94987a 100644
--- a/test/slop_test.rb
+++ b/test/slop_test.rb
@@ -448,6 +448,21 @@ class SlopTest < TestCase
end
end
+ test "ensure a runner does not execute when a help option is present" do
+ items = []
+ Slop.parse(%w'--help foo bar') do
+ run { |o, a| items.concat a }
+ end
+ assert_equal %w'--help foo bar', items
+ items.clear
+ temp_stdout do
+ Slop.parse(%w'--help foo bar', help: true) do
+ run { |o, a| items.concat a }
+ end
+ assert_empty items
+ end
+ end
+
test "duplicate options should not exist, new options should replace old ones" do
i = nil
Slop.parse(%w'-v') do