From 6e6ed91d0d5c3e2197f0207894a01226446759de Mon Sep 17 00:00:00 2001 From: Joe Gracyk Date: Mon, 10 May 2021 14:06:35 -0700 Subject: Add symbols to option types --- test/types_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/types_test.rb') 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 -- cgit v1.2.1 From 22e0e6e52f502493c00443a60c73809cfea539ff Mon Sep 17 00:00:00 2001 From: Joe Gracyk Date: Mon, 10 May 2021 14:07:05 -0700 Subject: Add simple tests for StringOption --- test/types_test.rb | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'test/types_test.rb') diff --git a/test/types_test.rb b/test/types_test.rb index ed13d5c..a45302a 100644 --- a/test/types_test.rb +++ b/test/types_test.rb @@ -1,5 +1,19 @@ 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 -- cgit v1.2.1