comparison src/testdir/test_substitute.vim @ 25617:28f1b7c38ba1 v8.2.3345

patch 8.2.3345: some code not covered by tests Commit: https://github.com/vim/vim/commit/bfb2bb16bc69441fa3ec13caacb2c94637a8a0ec Author: Dominique Pelle <dominique.pelle@gmail.com> Date: Sat Aug 14 21:11:51 2021 +0200 patch 8.2.3345: some code not covered by tests Problem: Some code not covered by tests. Solution: Add a few more tests. (Dominique Pell?, closes https://github.com/vim/vim/issues/8757)
author Bram Moolenaar <Bram@vim.org>
date Sat, 14 Aug 2021 21:15:02 +0200
parents b1093c1ac109
children b4c147ad4912
comparison
equal deleted inserted replaced
25616:1c4fe811755c 25617:28f1b7c38ba1
941 endif 941 endif
942 call assert_equal([0, 1, 1, 0, 1], getcurpos()) 942 call assert_equal([0, 1, 1, 0, 1], getcurpos())
943 bwipe! 943 bwipe!
944 endfunc 944 endfunc
945 945
946 " Test using the 'gdefault' option (when on, flag 'g' is default on).
947 func Test_substitute_gdefault()
948 new
949
950 " First check without 'gdefault'
951 call setline(1, 'foo bar foo')
952 s/foo/FOO/
953 call assert_equal('FOO bar foo', getline(1))
954 call setline(1, 'foo bar foo')
955 s/foo/FOO/g
956 call assert_equal('FOO bar FOO', getline(1))
957 call setline(1, 'foo bar foo')
958 s/foo/FOO/gg
959 call assert_equal('FOO bar foo', getline(1))
960
961 " Then check with 'gdefault'
962 set gdefault
963 call setline(1, 'foo bar foo')
964 s/foo/FOO/
965 call assert_equal('FOO bar FOO', getline(1))
966 call setline(1, 'foo bar foo')
967 s/foo/FOO/g
968 call assert_equal('FOO bar foo', getline(1))
969 call setline(1, 'foo bar foo')
970 s/foo/FOO/gg
971 call assert_equal('FOO bar FOO', getline(1))
972
973 " Setting 'compatible' should reset 'gdefault'
974 call assert_equal(1, &gdefault)
975 set compatible
976 call assert_equal(0, &gdefault)
977 set nocompatible
978 call assert_equal(0, &gdefault)
979
980 bw!
981 endfunc
982
946 " vim: shiftwidth=2 sts=2 expandtab 983 " vim: shiftwidth=2 sts=2 expandtab