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

Method IsFailureOutput

test/pseudo-tty/testcfg.py:59–92  ·  view source on GitHub ↗
(self, output)

Source from the content-addressed store, hash-verified

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