summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLee Jarvis <ljjarvis@gmail.com>2014-11-19 16:10:25 +0000
committerLee Jarvis <ljjarvis@gmail.com>2014-11-19 16:10:25 +0000
commit2a312300798d1da4aa666a0888f8a94a5ee5f245 (patch)
tree478345bf12957dc9c5f3402e65210c9d9b1b7c5d /test
parent899830973c6bed61d1230894f6a70cf4fe4e8339 (diff)
downloadslop-2a312300798d1da4aa666a0888f8a94a5ee5f245.tar.gz
Yield option arguments to option blocks
Diffstat (limited to 'test')
-rw-r--r--test/result_test.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/result_test.rb b/test/result_test.rb
index fb8ada2..41ed253 100644
--- a/test/result_test.rb
+++ b/test/result_test.rb
@@ -39,6 +39,13 @@ describe Slop::Result do
assert_equal %w(eel rab), @result.to_hash.values_at(:name, :foo)
end
+ it "yields arguments to option blocks" do
+ output = nil
+ @options.string("--foo") { |v| output = v }
+ @result.parser.reset.parse %w(--foo bar)
+ assert_equal output, "bar"
+ end
+
describe "#[]" do
it "returns an options value" do
assert_equal "lee", @result["name"]