annotate src/testdir/test_lispwords.vim @ 22707:9ff187b1652e v8.2.1902

patch 8.2.1902: default option values changed with :badd for existing buffer Commit: https://github.com/vim/vim/commit/e974fa7b2b98e53a59d5ef16a6a1291f12a32e33 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Oct 25 15:02:51 2020 +0100 patch 8.2.1902: default option values changed with :badd for existing buffer Problem: Default option values are changed when using :badd for an existing buffer. Solution: When calling buflist_new() pass a zero line number. (closes #7195)
author Bram Moolenaar <Bram@vim.org>
date Sun, 25 Oct 2020 15:15:03 +0100
parents 6d3c683466f4
children 9bc63b4f9c33
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
7293
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
1 " Tests for 'lispwords' settings being global-local
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
2
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3 set nocompatible viminfo+=nviminfo
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5 func Test_global_local_lispwords()
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 setglobal lispwords=foo,bar,baz
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 setlocal lispwords-=foo | setlocal lispwords+=quux
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 call assert_equal('foo,bar,baz', &g:lispwords)
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 call assert_equal('bar,baz,quux', &l:lispwords)
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
10 call assert_equal('bar,baz,quux', &lispwords)
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
11
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12 setlocal lispwords<
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 call assert_equal('foo,bar,baz', &g:lispwords)
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
14 call assert_equal('foo,bar,baz', &l:lispwords)
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
15 call assert_equal('foo,bar,baz', &lispwords)
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 endfunc
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
17
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
18 func Test_lisp_indent()
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
19 enew!
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
20
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
21 call append(0, [
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
22 \ '(defun html-file (base)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
23 \ '(format nil "~(~A~).html" base))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
24 \ '',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
25 \ '(defmacro page (name title &rest body)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
26 \ '(let ((ti (gensym)))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
27 \ '`(with-open-file (*standard-output*',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
28 \ '(html-file ,name)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
29 \ ':direction :output',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
30 \ ':if-exists :supersede)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
31 \ '(let ((,ti ,title))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
32 \ '(as title ,ti)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
33 \ '(with center ',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
34 \ '(as h2 (string-upcase ,ti)))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
35 \ '(brs 3)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
36 \ ',@body))))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
37 \ '',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
38 \ ';;; Utilities for generating links',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
39 \ '',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
40 \ '(defmacro with-link (dest &rest body)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
41 \ '`(progn',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
42 \ '(format t "<a href=\"~A\">" (html-file ,dest))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
43 \ ',@body',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
44 \ '(princ "</a>")))'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
45 \ ])
17916
2e53305f2239 patch 8.1.1954: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 12688
diff changeset
46 call assert_equal(7, lispindent(2))
2e53305f2239 patch 8.1.1954: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 12688
diff changeset
47 call assert_equal(5, 6->lispindent())
19603
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 17916
diff changeset
48 call assert_equal(-1, lispindent(-1))
17916
2e53305f2239 patch 8.1.1954: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 12688
diff changeset
49
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
50 set lisp
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
51 set lispwords&
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
52 let save_copt = &cpoptions
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
53 set cpoptions+=p
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
54 normal 1G=G
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
55
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
56 call assert_equal([
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
57 \ '(defun html-file (base)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
58 \ ' (format nil "~(~A~).html" base))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
59 \ '',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
60 \ '(defmacro page (name title &rest body)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
61 \ ' (let ((ti (gensym)))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
62 \ ' `(with-open-file (*standard-output*',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
63 \ ' (html-file ,name)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
64 \ ' :direction :output',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
65 \ ' :if-exists :supersede)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
66 \ ' (let ((,ti ,title))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
67 \ ' (as title ,ti)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
68 \ ' (with center ',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
69 \ ' (as h2 (string-upcase ,ti)))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
70 \ ' (brs 3)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
71 \ ' ,@body))))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
72 \ '',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
73 \ ';;; Utilities for generating links',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
74 \ '',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
75 \ '(defmacro with-link (dest &rest body)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
76 \ ' `(progn',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
77 \ ' (format t "<a href=\"~A\">" (html-file ,dest))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
78 \ ' ,@body',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
79 \ ' (princ "</a>")))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
80 \ ''
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
81 \ ], getline(1, "$"))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
82
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
83 enew!
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
84 let &cpoptions=save_copt
12688
a6a935b3270e patch 8.0.1222: test functions interfere with each other
Christian Brabandt <cb@256bit.org>
parents: 12560
diff changeset
85 set nolisp
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
86 endfunc
19603
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 17916
diff changeset
87
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 17916
diff changeset
88 " vim: shiftwidth=2 sts=2 expandtab