updated regex / test lib
git-svn-id: file:///home/svn/framework3/trunk@11002 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
b171d5192e
commit
8fbb01a93f
|
@ -10,22 +10,32 @@ require 'test/unit'
|
|||
class MsfTestCase < Test::Unit::TestCase
|
||||
|
||||
def assert_complete(data,first,last)
|
||||
@regexr = Regexr.new
|
||||
@regexr = Regexr.new(true)
|
||||
assert_not_nil @regexr.verify_start(data,first), "The start string " + data.split("\n").first + " did not match the expected string: " + first
|
||||
assert_not_nil @regexr.verify_end(data,last), "The end string " + data.split("\n").last + " did not match the expected string: " + last
|
||||
end
|
||||
|
||||
def assert_all_successes(data, regex_strings)
|
||||
@regexr = Regexr.new
|
||||
regex_strings.each { |regex_string|
|
||||
assert_true @regexr.ensure_exists_in_data(data,regex_string), "The string " + regex_string + " was not found in the data."
|
||||
}
|
||||
@regexr = Regexr.new(true)
|
||||
if regex_strings
|
||||
regex_strings.each { |regex_string|
|
||||
puts "Making sure " + regex_string + " is included."
|
||||
assert_true @regexr.ensure_exists_in_data(data,regex_string), "The string " + regex_string + " was not found in the data."
|
||||
}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def scan_for_errors(data)
|
||||
scan_for_failures(data,['exception'],[])
|
||||
end
|
||||
|
||||
def assert_no_failures(data, regex_strings, exception_strings)
|
||||
@regexr = Regexr.new
|
||||
regex_strings.each { |regex_string|
|
||||
assert_true @regexr.ensure_doesnt_exist_in_data_unless(data,regex_string,exception_strings), "The string " + regex_string + " was found in the the data, and no exception was found."
|
||||
}
|
||||
@regexr = Regexr.new(true)
|
||||
if regex_strings
|
||||
regex_strings.each { |regex_string|
|
||||
puts "Making sure " + regex_string + " isn't included."
|
||||
assert_true @regexr.ensure_doesnt_exist_in_data_unless(data,regex_string,exception_strings), "The string " + regex_string + " was found in the the data, and no exception was found."
|
||||
}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -16,7 +16,7 @@ class Regexr
|
|||
data_lines = data.split("\n")
|
||||
regex_start = Regexp.new(the_start, @case_insensitive)
|
||||
if @verbose
|
||||
puts "testing: " + the_start + " =~ " + data_lines.first
|
||||
puts "Testing: " + the_start + " =~ " + data_lines.first
|
||||
end
|
||||
return regex_start =~ data_lines.first
|
||||
end
|
||||
|
@ -26,7 +26,7 @@ class Regexr
|
|||
data_lines = data.split("\n")
|
||||
regex_end = Regexp.new(the_end, @case_insensitive)
|
||||
if @verbose
|
||||
puts "testing: " + the_end + " =~ " + data_lines.last
|
||||
puts "Testing: " + the_end + " =~ " + data_lines.last
|
||||
end
|
||||
return regex_end =~ data_lines.last
|
||||
end
|
||||
|
@ -38,8 +38,8 @@ class Regexr
|
|||
regex_end = Regexp.new(the_end, @case_insensitive)
|
||||
|
||||
if @verbose
|
||||
puts "testing: " + the_start + " =~ " + data_lines.first
|
||||
puts "testing: " + the_end + " =~ " + data_lines.last
|
||||
puts "Testing: " + the_start + " =~ " + data_lines.first
|
||||
puts "Testing: " + the_end + " =~ " + data_lines.last
|
||||
end
|
||||
|
||||
if regex_start =~ data_lines.first
|
||||
|
|
Loading…
Reference in New Issue