Mercurial > vim
comparison src/testdir/screendump.vim @ 14693:156a7c5328a7 v8.1.0359
patch 8.1.0359: no clue what test failed when using a screendump twice
commit https://github.com/vim/vim/commit/6f8bdab8e2ffec07aea03447f87c80b50e01f430
Author: Bram Moolenaar <Bram@vim.org>
Date: Sun Sep 9 22:02:24 2018 +0200
patch 8.1.0359: no clue what test failed when using a screendump twice
Problem: No clue what test failed when using a screendump twice.
Solution: Add an extra argument to VerifyScreenDump().
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Sun, 09 Sep 2018 22:15:06 +0200 |
parents | d1eac0853a20 |
children | 9339601e7a31 |
comparison
equal
deleted
inserted
replaced
14692:e77ffc311025 | 14693:156a7c5328a7 |
---|---|
91 endfunc | 91 endfunc |
92 | 92 |
93 " Verify that Vim running in terminal buffer "buf" matches the screen dump. | 93 " Verify that Vim running in terminal buffer "buf" matches the screen dump. |
94 " "options" is passed to term_dumpwrite(). | 94 " "options" is passed to term_dumpwrite(). |
95 " The file name used is "dumps/{filename}.dump". | 95 " The file name used is "dumps/{filename}.dump". |
96 " Optionally an extra argument can be passed which is prepended to the error | |
97 " message. Use this when using the same dump file with different options. | |
96 " Will wait for up to a second for the screen dump to match. | 98 " Will wait for up to a second for the screen dump to match. |
97 func VerifyScreenDump(buf, filename, options) | 99 " Returns non-zero when verification fails. |
100 func VerifyScreenDump(buf, filename, options, ...) | |
98 let reference = 'dumps/' . a:filename . '.dump' | 101 let reference = 'dumps/' . a:filename . '.dump' |
99 let testfile = a:filename . '.dump.failed' | 102 let testfile = a:filename . '.dump.failed' |
100 | 103 |
101 let i = 0 | 104 let i = 0 |
102 while 1 | 105 while 1 |
106 call delete(testfile) | 109 call delete(testfile) |
107 break | 110 break |
108 endif | 111 endif |
109 if i == 100 | 112 if i == 100 |
110 " Leave the test file around for inspection. | 113 " Leave the test file around for inspection. |
111 call assert_report('See dump file difference: call term_dumpdiff("' . testfile . '", "' . reference . '")') | 114 let msg = 'See dump file difference: call term_dumpdiff("' . testfile . '", "' . reference . '")' |
112 break | 115 if a:0 == 1 |
116 let msg = a:1 . ': ' . msg | |
117 endif | |
118 call assert_report(msg) | |
119 return 1 | |
113 endif | 120 endif |
114 sleep 10m | 121 sleep 10m |
115 let i += 1 | 122 let i += 1 |
116 endwhile | 123 endwhile |
124 return 0 | |
117 endfunc | 125 endfunc |