| 40 | #------------------------------------------------------------------------------ |
| 41 | |
| 42 | def testCompare(tmpFileName, stdout, expectFile, f, args, time): |
| 43 | expect = open(expectFile, 'r', encoding='utf-8').read() |
| 44 | |
| 45 | # align line-endings under Windows to Unix-style |
| 46 | if os.name == 'nt': |
| 47 | stdout = stdout.replace('\r\n', '\n') |
| 48 | |
| 49 | if stdout != expect: |
| 50 | print('[FAILED] %s - %s' %(f, time)) |
| 51 | |
| 52 | for line in difflib.unified_diff(expect.splitlines(keepends=True), stdout.splitlines(keepends=True), fromfile=expectFile, tofile='stdout', n=3): |
| 53 | print('%s' %((line[1:] if line.startswith(' ') else line) ), end='') |
| 54 | else: |
| 55 | print('[PASSED] %-50s - %s' %(f, time)) |
| 56 | return True |
| 57 | |
| 58 | return False |
| 59 | #------------------------------------------------------------------------------ |
| 60 | |
| 61 | def testCompile(tmpFileName, f, args, fileName, cppStd): |