From: "Mauricio Fernández" Date: 2004-08-17T18:17:49+09:00 Subject: Re: Idea for testing ruvi On Tue, Aug 17, 2004 at 01:08:48PM +0900, Hal Fulton wrote: > I'd really like to have a vim-like editor scriptable in > Ruby, so I hope to contribute test cases at the very least. > > Here's an idea I have. > > Suppose we have a "canonical" file, a text file about 2K or so > in length, to use as a starting point. > > Then vim can happily read stdin (as can ruvi I guess). > > Hmm. Actually I just tried ruvi with stdin and had a problem. > But I'm guessing that's a quick fix. > > So anyway, the idea is basically this. > > cp testfile test1 > cp testfile test2 > vim test1 /dev/null # edit with vim according to 'cmds' > ruvi test2 /dev/null # edit w/ ruvi according to 'cmds' > > Then if test1 and test2 are the same, the test passes. Take a look at testcases.rb in the ruvi sources: he's already doing something like that at a command level, and also verifying cursor position and in general more state than just the output text. I think the approach you describe could be a very good acceptance test (and indeed, those who want an accurate reproduction of the subset of vim they use could define their own acceptance tests that way), but it could be less useful for debugging since it might be difficult to infer what went wrong from the mere comparison of the outputs. Now, if you manage to dump all the intermediate states in vim, you could generate a massive amount of test cases in little time, as opposed to creating them by hand which is what has been done so far. -- Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com