annotate src/testdir/test_lispwords.vim @ 29338:f4f531986753 v9.0.0012

patch 9.0.0012: signature files not detected properly Commit: https://github.com/vim/vim/commit/cdbfc6dbab1d63aa56af316d6b13e37939e7f7a8 Author: Bram Moolenaar <Bram@vim.org> Date: Thu Jun 30 16:25:21 2022 +0100 patch 9.0.0012: signature files not detected properly Problem: Signature files not detected properly. Solution: Add a function to better detect signature files. (Doug Kearns)
author Bram Moolenaar <Bram@vim.org>
date Thu, 30 Jun 2022 17:30:06 +0200
parents 9bc63b4f9c33
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
29265
9bc63b4f9c33 patch 8.2.5151: reading beyond the end of the line with lisp indenting
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
1 " Tests for 'lispwords' settings being global-local.
9bc63b4f9c33 patch 8.2.5151: reading beyond the end of the line with lisp indenting
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
2 " And other lisp indent stuff.
7293
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
3
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
4 set nocompatible viminfo+=nviminfo
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
5
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
6 func Test_global_local_lispwords()
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
7 setglobal lispwords=foo,bar,baz
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
8 setlocal lispwords-=foo | setlocal lispwords+=quux
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
9 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
10 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
11 call assert_equal('bar,baz,quux', &lispwords)
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
12
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
13 setlocal 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', &g: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', &l:lispwords)
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
16 call assert_equal('foo,bar,baz', &lispwords)
979f8a595326 commit https://github.com/vim/vim/commit/6cd1345307440491580e5e86cb82c54ee9a46baa
Christian Brabandt <cb@256bit.org>
parents:
diff changeset
17 endfunc
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
18
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
19 func Test_lisp_indent()
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
20 enew!
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
21
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
22 call append(0, [
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
23 \ '(defun html-file (base)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
24 \ '(format nil "~(~A~).html" base))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
25 \ '',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
26 \ '(defmacro page (name title &rest body)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
27 \ '(let ((ti (gensym)))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
28 \ '`(with-open-file (*standard-output*',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
29 \ '(html-file ,name)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
30 \ ':direction :output',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
31 \ ':if-exists :supersede)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
32 \ '(let ((,ti ,title))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
33 \ '(as title ,ti)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
34 \ '(with center ',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
35 \ '(as h2 (string-upcase ,ti)))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
36 \ '(brs 3)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
37 \ ',@body))))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
38 \ '',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
39 \ ';;; Utilities for generating links',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
40 \ '',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
41 \ '(defmacro with-link (dest &rest body)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
42 \ '`(progn',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
43 \ '(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
44 \ ',@body',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
45 \ '(princ "</a>")))'
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
46 \ ])
17916
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(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
48 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
49 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
50
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
51 set lisp
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
52 set lispwords&
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
53 let save_copt = &cpoptions
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
54 set cpoptions+=p
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
55 normal 1G=G
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
56
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
57 call assert_equal([
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
58 \ '(defun html-file (base)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
59 \ ' (format nil "~(~A~).html" base))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
60 \ '',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
61 \ '(defmacro page (name title &rest body)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
62 \ ' (let ((ti (gensym)))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
63 \ ' `(with-open-file (*standard-output*',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
64 \ ' (html-file ,name)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
65 \ ' :direction :output',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
66 \ ' :if-exists :supersede)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
67 \ ' (let ((,ti ,title))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
68 \ ' (as title ,ti)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
69 \ ' (with center ',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
70 \ ' (as h2 (string-upcase ,ti)))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
71 \ ' (brs 3)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
72 \ ' ,@body))))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
73 \ '',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
74 \ ';;; Utilities for generating links',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
75 \ '',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
76 \ '(defmacro with-link (dest &rest body)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
77 \ ' `(progn',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
78 \ ' (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
79 \ ' ,@body',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
80 \ ' (princ "</a>")))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
81 \ ''
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
82 \ ], getline(1, "$"))
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
83
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
84 enew!
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
85 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
86 set nolisp
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
87 endfunc
19603
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 17916
diff changeset
88
29265
9bc63b4f9c33 patch 8.2.5151: reading beyond the end of the line with lisp indenting
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
89 func Test_lisp_indent_works()
9bc63b4f9c33 patch 8.2.5151: reading beyond the end of the line with lisp indenting
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
90 " This was reading beyond the end of the line
9bc63b4f9c33 patch 8.2.5151: reading beyond the end of the line with lisp indenting
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
91 new
9bc63b4f9c33 patch 8.2.5151: reading beyond the end of the line with lisp indenting
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
92 exe "norm a\tü(\<CR>="
9bc63b4f9c33 patch 8.2.5151: reading beyond the end of the line with lisp indenting
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
93 set lisp
9bc63b4f9c33 patch 8.2.5151: reading beyond the end of the line with lisp indenting
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
94 norm ==
9bc63b4f9c33 patch 8.2.5151: reading beyond the end of the line with lisp indenting
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
95 bwipe!
9bc63b4f9c33 patch 8.2.5151: reading beyond the end of the line with lisp indenting
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
96 endfunc
9bc63b4f9c33 patch 8.2.5151: reading beyond the end of the line with lisp indenting
Bram Moolenaar <Bram@vim.org>
parents: 19603
diff changeset
97
19603
6d3c683466f4 patch 8.2.0358: insufficient testing for indent.c
Bram Moolenaar <Bram@vim.org>
parents: 17916
diff changeset
98 " vim: shiftwidth=2 sts=2 expandtab