diff options
author | Bram Moolenaar <Bram@vim.org> | 2015-11-30 21:38:24 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2015-11-30 21:38:24 +0100 |
commit | 683fa185a4b4ed7595e5942901548b8239ed5cdb (patch) | |
tree | 72dc382b7d35b2efe9cc966a3049f8a61d462559 /runtime | |
parent | 43345546ae63710441f066648b8485fb545b3801 (diff) | |
download | vim-683fa185a4b4ed7595e5942901548b8239ed5cdb.zip |
patch 7.4.945
Problem: New style testing is incomplete.
Solution: Add the runtest script to the list of distributed files.
Add the new functions to the function overview.
Rename the functions to match Vim function style.
Move undolevels testing into a new style test script.
Diffstat (limited to 'runtime')
-rw-r--r-- | runtime/doc/eval.txt | 32 | ||||
-rw-r--r-- | runtime/doc/usr_41.txt | 7 |
2 files changed, 25 insertions, 14 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt index aae05227b..9442996be 100644 --- a/runtime/doc/eval.txt +++ b/runtime/doc/eval.txt @@ -1,4 +1,4 @@ -*eval.txt* For Vim version 7.4. Last change: 2015 Nov 29 +*eval.txt* For Vim version 7.4. Last change: 2015 Nov 30 VIM REFERENCE MANUAL by Bram Moolenaar @@ -1380,7 +1380,7 @@ v:errmsg Last given error message. It's allowed to set this variable. < "errmsg" also works, for backwards compatibility. *v:errors* *errors-variable* -v:errors Errors found by assert functions, such as |assertTrue()|. +v:errors Errors found by assert functions, such as |assert_true()|. This is a list of strings. The assert functions append an item when an assert fails. To remove old results make it empty: > @@ -1742,13 +1742,13 @@ append( {lnum}, {string}) Number append {string} below line {lnum} append( {lnum}, {list}) Number append lines {list} below line {lnum} argc() Number number of files in the argument list argidx() Number current index in the argument list -arglistid( [{winnr}, [ {tabnr}]]) +arglistid( [{winnr} [, {tabnr}]]) Number argument list id argv( {nr}) String {nr} entry of the argument list argv( ) List the argument list -assertEqual( {exp}, {act}) none assert that {exp} equals {act} -assertFalse( {actual}) none assert that {actual} is false -assertTrue( {actual}) none assert that {actual} is true +assert_equal( {exp}, {act} [, {msg}]) none assert that {exp} equals {act} +assert_false( {actual} [, {msg}]) none assert that {actual} is false +assert_true( {actual} [, {msg}]) none assert that {actual} is true asin( {expr}) Float arc sine of {expr} atan( {expr}) Float arc tangent of {expr} atan2( {expr}, {expr}) Float arc tangent of {expr1} / {expr2} @@ -2166,30 +2166,36 @@ argv([{nr}]) The result is the {nr}th file in the argument list of the < Without the {nr} argument a |List| with the whole |arglist| is returned. - *assertEqual()* -assertEqual({expected}, {actual}) + *assert_equal()* +assert_equal({expected}, {actual}, [, {msg}]) When {expected} and {actual} are not equal an error message is added to |v:errors|. There is no automatic conversion, the String "4" is different from the Number 4. And the number 4 is different from the Float 4.0. The value of 'ignorecase' is not used here, case always matters. + When {msg} is omitted an error in the form "Expected + {expected} but got {actual}" is produced. Example: > - assertEqual('foo', 'bar') + assert_equal('foo', 'bar') < Will result in a string to be added to |v:errors|: test.vim line 12: Expected 'foo' but got 'bar' ~ -assertFalse({actual}) *assertFalse()* +assert_false({actual}, [, {msg}]) *assert_false()* When {actual} is not false an error message is added to - |v:errors|, like with |assertEqual()|.. + |v:errors|, like with |assert_equal()|.. A value is false when it is zero. When "{actual}" is not a number the assert fails. + When {msg} is omitted an error in the form "Expected False but + got {actual}" is produced. -assertTrue({actual}) *assertTrue()* +assert_true({actual}, [, {msg}]) *assert_true()* When {actual} is not true an error message is added to - |v:errors|, like with |assertEqual()|.. + |v:errors|, like with |assert_equal()|.. A value is true when it is a non-zeron number. When {actual} is not a number the assert fails. + When {msg} is omitted an error in the form "Expected True but + got {actual}" is produced. asin({expr}) *asin()* Return the arc sine of {expr} measured in radians, as a |Float| diff --git a/runtime/doc/usr_41.txt b/runtime/doc/usr_41.txt index 28bdbad89..eb1d5f7fb 100644 --- a/runtime/doc/usr_41.txt +++ b/runtime/doc/usr_41.txt @@ -1,4 +1,4 @@ -*usr_41.txt* For Vim version 7.4. Last change: 2014 Aug 16 +*usr_41.txt* For Vim version 7.4. Last change: 2015 Nov 30 VIM USER MANUAL - by Bram Moolenaar @@ -888,6 +888,11 @@ Mappings: *mapping-functions* maparg() get rhs of a mapping wildmenumode() check if the wildmode is active +Testing: *test-functions* + assert_equal() assert that two expressions values are equal + assert_false() assert that an expression is false + assert_true() assert that an expression is true + Various: *various-functions* mode() get current editing mode visualmode() last visual mode used |