add 'file_equal' and 'file_match'
This commit is contained in:
parent
4d1fdabb55
commit
58260c5a21
@ -98,6 +98,12 @@ class TC_example(TestCase):
|
|||||||
], 'utf-16')
|
], 'utf-16')
|
||||||
c.stdout_match("tt", 'utf-16')
|
c.stdout_match("tt", 'utf-16')
|
||||||
|
|
||||||
|
c.file_equal("abc.txt", [
|
||||||
|
'detta är abc.txtx',
|
||||||
|
'räksmörgås',
|
||||||
|
], 'utf-16')
|
||||||
|
c.file_match("abc.txt", "tt", 'utf-16')
|
||||||
|
|
||||||
with self.cmd("true") as c:
|
with self.cmd("true") as c:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ def error_show(name, what, arg):
|
|||||||
try:
|
try:
|
||||||
msg = arg.error_msg(what)
|
msg = arg.error_msg(what)
|
||||||
except:
|
except:
|
||||||
if name.startswith('stdout_') or name.startswith('stderr_'):
|
if re.match(r'(stdout|stderr|file)_', name):
|
||||||
print(what)
|
print(what)
|
||||||
if len(arg) == 0:
|
if len(arg) == 0:
|
||||||
print(" <<empty>>")
|
print(" <<empty>>")
|
||||||
@ -231,6 +231,14 @@ class Result:
|
|||||||
expect = ExpectFile(self, content, encoding)
|
expect = ExpectFile(self, content, encoding)
|
||||||
expect.check("stderr_equal", self._stderr)
|
expect.check("stderr_equal", self._stderr)
|
||||||
|
|
||||||
|
def file_match(self, fname, pattern, encoding='utf-8'):
|
||||||
|
expect = ExpectPattern(self, pattern, encoding)
|
||||||
|
expect.check("file_match %s" % fname, File(fname))
|
||||||
|
|
||||||
|
def file_equal(self, fname, content, encoding='utf-8'):
|
||||||
|
expect = ExpectFile(self, content, encoding)
|
||||||
|
expect.check("file_equal %s" % fname, File(fname))
|
||||||
|
|
||||||
TESTS = {
|
TESTS = {
|
||||||
"created_files" : (lambda before,after: not before and after,
|
"created_files" : (lambda before,after: not before and after,
|
||||||
{"created"}),
|
{"created"}),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user