summaryrefslogtreecommitdiff
path: root/tool/lib/test/unit/assertions.rb
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2020-07-02 20:48:56 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-07-02 20:53:42 +0900
commit59ded36c60b9420d1071679510acc07424b235f3 (patch)
tree2880d03926ca80490c46456cf05accfe9546a7be /tool/lib/test/unit/assertions.rb
parent08ba5bec2b42cf18231b3b045fd6a592e5bacbf4 (diff)
Expose `assert_pattern_list` for drb test with test-unit gem.
Diffstat (limited to 'tool/lib/test/unit/assertions.rb')
-rw-r--r--tool/lib/test/unit/assertions.rb43
1 files changed, 0 insertions, 43 deletions
diff --git a/tool/lib/test/unit/assertions.rb b/tool/lib/test/unit/assertions.rb
index 907e918639..88b953627f 100644
--- a/tool/lib/test/unit/assertions.rb
+++ b/tool/lib/test/unit/assertions.rb
@@ -372,49 +372,6 @@ EOT
assert(1.0/f == -Float::INFINITY, "#{f} is not -0.0")
end
- # pattern_list is an array which contains regexp and :*.
- # :* means any sequence.
- #
- # pattern_list is anchored.
- # Use [:*, regexp, :*] for non-anchored match.
- def assert_pattern_list(pattern_list, actual, message=nil)
- rest = actual
- anchored = true
- pattern_list.each_with_index {|pattern, i|
- if pattern == :*
- anchored = false
- else
- if anchored
- match = /\A#{pattern}/.match(rest)
- else
- match = pattern.match(rest)
- end
- unless match
- msg = message(msg) {
- expect_msg = "Expected #{mu_pp pattern}\n"
- if /\n[^\n]/ =~ rest
- actual_mesg = +"to match\n"
- rest.scan(/.*\n+/) {
- actual_mesg << ' ' << $&.inspect << "+\n"
- }
- actual_mesg.sub!(/\+\n\z/, '')
- else
- actual_mesg = "to match " + mu_pp(rest)
- end
- actual_mesg << "\nafter #{i} patterns with #{actual.length - rest.length} characters"
- expect_msg + actual_mesg
- }
- assert false, msg
- end
- rest = match.post_match
- anchored = true
- end
- }
- if anchored
- assert_equal("", rest)
- end
- end
-
def assert_all_assertions_foreach(msg = nil, *keys, &block)
all = AllFailures.new
all.foreach(*keys, &block)