diff options
author | Lee Jarvis <leejarvis@fastmail.com> | 2021-05-11 14:02:38 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-05-11 14:02:38 +0100 |
commit | a8e94a28caffe48f5cd18086d533d9e7afeb74eb (patch) | |
tree | 1329bf0982a775e4549c24c4a19b5af3c3149ea4 /test/types_test.rb | |
parent | 3cbd0e9dfaa6804d6f46fbbec08155a680193cd7 (diff) | |
parent | 22e0e6e52f502493c00443a60c73809cfea539ff (diff) | |
download | slop-a8e94a28caffe48f5cd18086d533d9e7afeb74eb.tar.gz |
Merge pull request #263 from threemachines/symbols
Add symbols to option types
Diffstat (limited to 'test/types_test.rb')
-rw-r--r-- | test/types_test.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/types_test.rb b/test/types_test.rb index d71c737..a45302a 100644 --- a/test/types_test.rb +++ b/test/types_test.rb @@ -1,5 +1,33 @@ require 'test_helper' +describe Slop::StringOption do + before do + @options = Slop::Options.new + @age = @options.string "--name" + @minus = @options.string "--zipcode" + @result = @options.parse %w(--name Foo --zipcode 12345) + end + + it "returns the value as a string" do + assert_equal "Foo", @result[:name] + assert_equal "12345", @result[:zipcode] + end +end + +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 |