Skip to content

Commit 943dde5

Browse files
David MaloneyDavid Maloney
authored andcommitted
OptRegexp specs
1 parent 2fc397b commit 943dde5

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

lib/msf/core/option_container.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -487,7 +487,7 @@ def valid?(value)
487487
Regexp.compile(value)
488488

489489
return true
490-
rescue RegexpError
490+
rescue RegexpError, TypeError
491491
return false
492492
end
493493
end
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# -*- coding:binary -*-
2+
3+
require 'spec_helper'
4+
require 'msf/core/option_container'
5+
6+
describe Msf::OptRegexp do
7+
8+
valid_values = [
9+
{ :value => '^foo$', :normalized => /^foo$/ },
10+
]
11+
invalid_values = [
12+
{ :value => 123 },
13+
{ :value => 'foo('}
14+
]
15+
16+
it_behaves_like "an option", valid_values, invalid_values, 'regexp'
17+
end

0 commit comments

Comments
 (0)