summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLaurent Arnoud <laurent@spkdev.net>2015-05-17 16:57:18 +0200
committerLaurent Arnoud <laurent@spkdev.net>2015-05-17 16:57:18 +0200
commite7521a65b01560ac997ccb907d33e4b3795533a7 (patch)
tree3bfe8e7cef6c792ebfc0e977b8af34c1ef18b4e8 /test
parent4078a1bcfa731fe0f15e3e7d2d4bcf0ac312d435 (diff)
downloadslop-e7521a65b01560ac997ccb907d33e4b3795533a7.tar.gz
Added support for Regexp
Used to work on 3.6 See https://github.com/leejarvis/slop/commit/e2775e27d866ba85f6b6bf50536135ee4e93c93e
Diffstat (limited to 'test')
-rw-r--r--test/types_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/types_test.rb b/test/types_test.rb
index 39cccc9..81ae3ba 100644
--- a/test/types_test.rb
+++ b/test/types_test.rb
@@ -100,3 +100,16 @@ describe Slop::NullOption do
assert_equal({}, @result.to_hash)
end
end
+
+describe Slop::RegexpOption do
+ before do
+ @options = Slop::Options.new
+ @exclude = @options.regexp "--exclude"
+ @exclude_value = "redirect|news"
+ @result = @options.parse %W(--exclude #{@exclude_value})
+ end
+
+ it "returns the value as a Regexp" do
+ assert_equal Regexp.new(@exclude_value), @result[:exclude]
+ end
+end