summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJoe Gracyk <jgracyk@squareup.com>2021-05-10 14:06:35 -0700
committerJoe Gracyk <jgracyk@squareup.com>2021-05-10 14:06:35 -0700
commit6e6ed91d0d5c3e2197f0207894a01226446759de (patch)
tree87095784fdb633dc656ffe78f55f344775ed2189 /test
parent3cbd0e9dfaa6804d6f46fbbec08155a680193cd7 (diff)
downloadslop-6e6ed91d0d5c3e2197f0207894a01226446759de.tar.gz
Add symbols to option types
Diffstat (limited to 'test')
-rw-r--r--test/types_test.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/types_test.rb b/test/types_test.rb
index d71c737..ed13d5c 100644
--- a/test/types_test.rb
+++ b/test/types_test.rb
@@ -1,5 +1,19 @@
require 'test_helper'
+describe Slop::SymbolOption do
+ before do
+ @options = Slop::Options.new
+ @age = @options.symbol "--name"
+ @minus = @options.symbol "--zipcode"
+ @result = @options.parse %w(--name Foo --zipcode 12345)
+ end
+
+ it "returns the value as a symbol" do
+ assert_equal :Foo, @result[:name]
+ assert_equal :'12345', @result[:zipcode]
+ end
+end
+
describe Slop::BoolOption do
before do
@options = Slop::Options.new