MCPcopy Index your code
hub / github.com/nodejs/node / IsFailureOutput

Method IsFailureOutput

test/message/testcfg.py:54–91  ·  view source on GitHub ↗
(self, output)

Source from the content-addressed store, hash-verified

52 else: return str.startswith('==') or str.startswith('**')
53
54 def IsFailureOutput(self, output):
55 f = open(self.expected)
56 # Skip initial '#' comment and spaces
57 #for line in f:
58 # if (not line.startswith('#')) and (not line.strip()):
59 # break
60 # Convert output lines to regexps that we can match
61 env = { 'basename': basename(self.file) }
62 patterns = [ ]
63 for line in f:
64 if not line.strip():
65 continue
66 pattern = re.escape(line.rstrip() % env)
67 pattern = pattern.replace('\\*', '.*')
68 pattern = '^%s$' % pattern
69 patterns.append(pattern)
70 # Compare actual output with the expected
71 raw_lines = (output.stdout + output.stderr).split('\n')
72 outlines = [ s for s in raw_lines if not self.IgnoreLine(s) ]
73 if len(outlines) != len(patterns):
74 print("length differs.")
75 print("expect=%d" % len(patterns))
76 print("actual=%d" % len(outlines))
77 print("patterns:")
78 for i in range(len(patterns)):
79 print("pattern = %s" % patterns[i])
80 print("outlines:")
81 for i in range(len(outlines)):
82 print("outline = %s" % outlines[i])
83 return True
84 for i in range(len(patterns)):
85 if not re.match(patterns[i], outlines[i]):
86 print("match failed")
87 print("line=%d" % i)
88 print("expect=%s" % patterns[i])
89 print("actual=%s" % outlines[i])
90 return True
91 return False
92
93 def _parse_source_env(self, source):
94 env_match = ENV_PATTERN.search(source)

Callers

nothing calls this directly

Calls 9

IgnoreLineMethod · 0.95
basenameFunction · 0.90
matchMethod · 0.65
openFunction · 0.50
printFunction · 0.50
rangeFunction · 0.50
escapeMethod · 0.45
appendMethod · 0.45
splitMethod · 0.45

Tested by

no test coverage detected