-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
normalize and escape regex to properly filter. fixes #78
- Loading branch information
Showing
1 changed file
with
10 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -70,9 +70,9 @@ def _run_suite suite, type | |
# suites are cases in minitest | ||
@turn_case = @turn_suite.new_case(suite.name) | ||
|
||
filter = @options[:filter] || @turn_config.pattern || /./ | ||
filter = normalize_filter(@options[:filter]) || @turn_config.pattern || /./ | ||
|
||
suite.send("#{type}_methods").grep(filter).each do |test| | ||
suite.send("#{type}_methods").grep(/#{filter}/).each do |test| | ||
@turn_case.new_test(test) | ||
end | ||
|
||
|
@@ -122,6 +122,14 @@ def puke(klass, meth, err) | |
super(klass, meth, err) | ||
end | ||
|
||
private | ||
|
||
# regex gets turned into a string literal with leading/trailing slashes | ||
# so remove them | ||
def normalize_filter(filter) | ||
filter.sub(/^(\/)/, '').sub(/(\/)$/, '') if filter | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
daniely
Author
Member
|
||
end | ||
|
||
end | ||
|
||
end |
Maybe something like
"/sdfdsf/".tr(?/, '') #=> "sdfdsf"
is simpler?