annotate src/testdir/test_lispwords.vim @ 18991:847cc7932c42 v8.2.0056

patch 8.2.0056: execution stack is incomplete and inefficient Commit: https://github.com/vim/vim/commit/1a47ae32cdc19b0fd5a82e19fe5fddf45db1a506 Author: Bram Moolenaar <Bram@vim.org> Date: Sun Dec 29 23:04:25 2019 +0100 patch 8.2.0056: execution stack is incomplete and inefficient Problem: Execution stack is incomplete and inefficient. Solution: Introduce a proper execution stack and use it instead of sourcing_name/sourcing_lnum. Create a string only when used.
author Bram Moolenaar <Bram@vim.org>
date Sun, 29 Dec 2019 23:15:04 +0100
parents 2e53305f2239
children 6d3c683466f4
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())
2e53305f2239 patch 8.1.1954: more functions can be used as a method
Bram Moolenaar <Bram@vim.org>
parents: 12688
diff changeset
48
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
49 set lisp
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
50 set lispwords&
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
51 let save_copt = &cpoptions
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
52 set cpoptions+=p
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
53 normal 1G=G
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
54
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
55 call assert_equal([
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
56 \ '(defun html-file (base)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
57 \ ' (format nil "~(~A~).html" base))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
58 \ '',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
59 \ '(defmacro page (name title &rest body)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
60 \ ' (let ((ti (gensym)))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
61 \ ' `(with-open-file (*standard-output*',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
62 \ ' (html-file ,name)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
63 \ ' :direction :output',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
64 \ ' :if-exists :supersede)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
65 \ ' (let ((,ti ,title))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
66 \ ' (as title ,ti)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
67 \ ' (with center ',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
68 \ ' (as h2 (string-upcase ,ti)))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
69 \ ' (brs 3)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
70 \ ' ,@body))))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
71 \ '',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
72 \ ';;; Utilities for generating links',
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 \ '(defmacro with-link (dest &rest body)',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
75 \ ' `(progn',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
76 \ ' (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
77 \ ' ,@body',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
78 \ ' (princ "</a>")))',
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
79 \ ''
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
80 \ ], getline(1, "$"))
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 enew!
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
83 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
84 set nolisp
12560
44aa2997239d patch 8.0.1158: still old style tests
Christian Brabandt <cb@256bit.org>
parents: 7293
diff changeset
85 endfunc