summaryrefslogtreecommitdiff
path: root/test/option_test.rb
diff options
context:
space:
mode:
authorLee Jarvis <lee@jarvis.co>2012-01-15 01:25:11 +0000
committerLee Jarvis <lee@jarvis.co>2012-01-15 01:25:11 +0000
commitc1104321ab74bf8eeb0f6877bbc8a5c31c772cfc (patch)
treec3cb5e16eff8090813e6b3f8db1acdf08d31fa7d /test/option_test.rb
parentf069531f3ec9ed648bfdd73583f653461610793a (diff)
downloadslop-c1104321ab74bf8eeb0f6877bbc8a5c31c772cfc.tar.gz
ensure help strings are formatted
Diffstat (limited to 'test/option_test.rb')
-rw-r--r--test/option_test.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/option_test.rb b/test/option_test.rb
index 4b8f68f..3aa59f4 100644
--- a/test/option_test.rb
+++ b/test/option_test.rb
@@ -91,4 +91,15 @@ class OptionTest < TestCase
opts.parse %w'-f'
assert_equal 'foo', opts[:f]
end
+
+ test "printing options" do
+ slop = Slop.new
+ slop.opt :n, :name=, 'Your name'
+ slop.opt :age=, 'Your age'
+ slop.opt :V, 'Display the version'
+
+ assert_equal " -n, --name Your name", slop.fetch_option(:name).to_s
+ assert_equal " --age Your age", slop.fetch_option(:age).to_s
+ assert_equal " -V, Display the version", slop.fetch_option(:V).help
+ end
end \ No newline at end of file