
import ast
import os
import unittest
import subprocess
from sys import platform

from 测试.unittest.Python到木兰 import *

from 测试.unittest.生成源码表 import 木兰源码表

原始可执行文件 = "ulang-0.2.2.exe"
头部信息 = "/* This file is auto-generated by the command `ulang -s `. */\n"

class test所有(unittest.TestCase):

    def test_python到木兰(self):
        for python路径 in 木兰源码表:
            木兰源码 = 木兰源码表[python路径]

            进程 = subprocess.Popen([原始可执行文件, '-s', python路径], stdout=subprocess.PIPE)
            反馈 = 进程.communicate()
            生成源码 = 反馈[0]
            self.assertEqual(生成源码.decode("utf-8").replace("\r\n", "\n"),
                头部信息 + "\n" + 木兰源码 + "\n",
                python路径 + " 转换错误")