summaryrefslogtreecommitdiff
path: root/test/parser_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/parser_test.rb')
-rw-r--r--test/parser_test.rb27
1 files changed, 18 insertions, 9 deletions
diff --git a/test/parser_test.rb b/test/parser_test.rb
index b729ee8..bbdc4a9 100644
--- a/test/parser_test.rb
+++ b/test/parser_test.rb
@@ -17,16 +17,25 @@ describe Slop::Parser do
assert_equal ["-v", "--name", "lee"], @parser.arguments
end
- it "parses flag=argument" do
- @options.integer "-p", "--port"
- @result.parser.parse %w(--name=bob -p=123)
- assert_equal "bob", @result[:name]
- assert_equal 123, @result[:port]
+ describe "for flag=argument" do
+ it "parses names and values" do
+ @options.integer "-p", "--port"
+ @result.parser.parse %w(--name=bob -p=123)
+ assert_equal "bob", @result[:name]
+ assert_equal 123, @result[:port]
+ end
- @options.string "--foo"
- @result.parser.parse %w(--foo = =)
- assert_equal "=", @result[:foo]
- assert_equal %w(=), @result.args
+ it "treats an = separated by a space as a value" do
+ @options.string "--foo"
+ @result.parser.parse %w(--foo = =)
+ assert_equal "=", @result[:foo]
+ assert_equal %w(=), @result.args
+ end
+
+ it "includes = in strings" do
+ @result.parser.parse(%w(--name=b=b))
+ assert_equal "b=b", @result[:name]
+ end
end
it "parses flag=''" do