summaryrefslogtreecommitdiff
path: root/test/option_test.rb
diff options
context:
space:
mode:
authorLee Jarvis <lee@jarvis.co>2011-12-23 15:11:20 +0000
committerLee Jarvis <lee@jarvis.co>2011-12-23 15:11:20 +0000
commit4c27582d4a0897ce7e17f569472ac793b0194e58 (patch)
tree99cefea90ea61d398e1b19b5c1dc04c2f9e49ff5 /test/option_test.rb
parente5ad83463825d42f1e7cc10b9012b5e8d50bc981 (diff)
downloadslop-4c27582d4a0897ce7e17f569472ac793b0194e58.tar.gz
added tests for Option#call
Diffstat (limited to 'test/option_test.rb')
-rw-r--r--test/option_test.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/option_test.rb b/test/option_test.rb
index 6b0e8ad..ef56aac 100644
--- a/test/option_test.rb
+++ b/test/option_test.rb
@@ -22,4 +22,13 @@ class OptionTest < TestCase
assert_equal 'foo', option(:f, :foo).key
assert_equal 'f', option(:f).key
end
+
+ test "call" do
+ foo = nil
+ option(:f, :callback => proc { foo = "bar" }).call
+ assert_equal "bar", foo
+ option(:f) { foo = "baz" }.call
+ assert_equal "baz", foo
+ option(:f) { |o| assert_equal 1, o }.call(1)
+ end
end \ No newline at end of file