Nazri Ramliy wrote: > On Thu, Jul 29, 2010 at 10:49 PM, Marc Weber <marco-owe...@gmx.de> wrote: > >> Is anyone aware of anything like a terminal-emulator version of > >> Selenium? > > What if we had some helper command that dumps how the > current screen look like so that it can be compared with > some "expected_dump.txt"? > > Something along the lines of: > > FILE *fd = fopen("dump.txt", "w"); > int r, c; > for (r = 0; r < screen_Rows; r++) > for (c = 0; c < screen_Columns; c++) > fputc(ScreenLines[r * screen_Columns + c], fd); > fputc('\n', fd); > fclose(fd); > > I think this would help in testing stuff that would not be > easy to test currently like 'relativenumber', and > completion-related stuff. > > Vim can then be told to dump the screen to a file by setting > up hooks, say, "dump the screen whenever this or that event > happen", or maybe done through the "--remote-send/expr" or > by sending signals. > > This implies that the test must be done in a pre-set terminal > size. > > The file "expected_dump.txt" would of course be prepared > through the same facility. > > I think the BOE (benefit-to-effort, as in signal-to-noise) ratio > would be quite high. > > Worth a shot? > > Hmm or we can just make use of the hardcopy feature in screen > (the terminal multiplexer)?
Using the lowest level information about the screen is a good idea. We don't test the communication with the terminal then, but that's a separate issue, and there have been very few problems in that area the last few years. We can use the remote facility from one Vim to control another Vim. Basically: Start Vim: :!vim --servername VIMTEST -u {test vimrc} Send command: :call remote_send("VIMTEST", ":edit file\<CR>") Evaluate effect: :echo remote_expr("VIMTEST", screen_char(0, 0)) The only thing missing is the function to obtain the properties of a screen character, such as screen_char(). That's easy to implement. This only works when compiled with the remote server feature, thus it won't work to test a small version. Not a real problem. We can't get output at the command line this way. Accessing the message history should help, but it doesn't store all the output. Perhaps a testing mode can be enabled to store all output on the command line and a function to obtain it. A few more generic things would be needed, such as a check that there was no error message. Perhaps someone can give this a start to test the conceal feature? That would be an excellent example of what we should be able to test this way. -- OLD WOMAN: Well, how did you become king, then? ARTHUR: The Lady of the Lake, her arm clad in the purest shimmering samite, held Excalibur aloft from the bosom of the water to signify by Divine Providence ... that I, Arthur, was to carry Excalibur ... That is why I am your king! "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- b...@moolenaar.net -- http://www.Moolenaar.net \\\ /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\ \\\ download, build and distribute -- http://www.A-A-P.org /// \\\ help me help AIDS victims -- http://ICCF-Holland.org /// -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php