Beispiel #1
0
 def do_lalr1gram(self, gram):
     path = self.write_content_to_tmpfile(gram, ".yogram")
     try:
         script = join(self.get_bin_dir(), "lalr1gram.yog")
         cmd = [get_command(), script, "gram.yog", path]
         proc = Popen(cmd, stdout=PIPE, stderr=PIPE, universal_newlines=True)
         proc.wait()
     finally:
         unlink(path)
     return proc
Beispiel #2
0
 def do_parser_test(self, gram, src, expected):
     self.do_lalr1gram(gram)
     path = self.write_content_to_tmpfile(src, ".yog")
     kw = {
             "args": [get_command(), path],
             "stdout": PIPE,
             "stderr": PIPE,
             "universal_newlines": True }
     try:
         proc = Popen(**kw)
         proc.wait()
     finally:
         unlink(path)
     assert expected == proc.stdout.read()
Beispiel #3
0
 def run_test(self, stdin, stdout="", stderr=""):
     cmd = [get_command(), "--gc-stress"]
     actual_stdout, actual_stderr = spawn(cmd, stdin + "\x04")
     self.do_test(stdout, actual_stdout)
     self.do_test(stderr, actual_stderr)