2015-11-29 19:53 GMT+03:00 Nikolay Pavlov <[email protected]>: > > > 2015-11-29 19:46 GMT+03:00 Bram Moolenaar <[email protected]>: > >> >> Testing Vim functionality has always been difficult. The tests in >> src/testdir are hard to write and even harder to read back. >> >> I have just sent out patch 7.4.944 which should make testing easier. >> This is what simple test looks like: >> >> func Test_assertFalse() >> call assertFalse(0) >> endfunc >> >> func Test_assertTrue() >> call assertTrue(1) >> call assertTrue(123) >> endfunc >> >> func Test_assertEqual() >> let s = 'foo' >> call assertEqual('foo', s) >> let n = 4 >> call assertEqual(4, n) >> let l = [1, 2, 3] >> call assertEqual([1, 2, 3], l) >> endfunc >> >> The asserts are done where the value is available. No need to dig >> through an .ok file or diff the .ok file with an .out file and then >> guess where in the test something went wrong. >> >> The test script finds all the Test_ functions and executes them, >> collecting any error messages from the asserts. >> >> An important limitation is that this only works with the +eval feature. >> Testing a small or tiny Vim build still requires the old kind of >> testing. >> >> What do you think? >> > > As I commented on the patch I think that functions need to have different > name. There was never a function that had upper case letter, using current > conventions I would expect `asserttrue`, `assertfalse` and `assertequal`. > Or `assert_true`, `assert_false` and `assert_equal`: though this is > uncommon, there are examples (`remote_*` and `complete_*`) of function > families using this convention. >
Underscore variants are more readable. > > > >> >> Obviously we can add more assert functions and improve their error >> messages. >> >> -- >> hundred-and-one symptoms of being an internet addict: >> 150. You find yourself counting emoticons to get to sleep. >> >> /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net >> \\\ >> /// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ >> \\\ >> \\\ an exciting new programming language -- http://www.Zimbu.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 >> >> --- >> You received this message because you are subscribed to the Google Groups >> "vim_dev" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> For more options, visit https://groups.google.com/d/optout. >> > > -- -- 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 --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
