1" Tests for 'lispwords' settings being global-local 2 3set nocompatible viminfo+=nviminfo 4 5func Test_global_local_lispwords() 6 setglobal lispwords=foo,bar,baz 7 setlocal lispwords-=foo | setlocal lispwords+=quux 8 call assert_equal('foo,bar,baz', &g:lispwords) 9 call assert_equal('bar,baz,quux', &l:lispwords) 10 call assert_equal('bar,baz,quux', &lispwords) 11 12 setlocal lispwords< 13 call assert_equal('foo,bar,baz', &g:lispwords) 14 call assert_equal('foo,bar,baz', &l:lispwords) 15 call assert_equal('foo,bar,baz', &lispwords) 16endfunc 17 18func Test_lisp_indent() 19 enew! 20 21 call append(0, [ 22 \ '(defun html-file (base)', 23 \ '(format nil "~(~A~).html" base))', 24 \ '', 25 \ '(defmacro page (name title &rest body)', 26 \ '(let ((ti (gensym)))', 27 \ '`(with-open-file (*standard-output*', 28 \ '(html-file ,name)', 29 \ ':direction :output', 30 \ ':if-exists :supersede)', 31 \ '(let ((,ti ,title))', 32 \ '(as title ,ti)', 33 \ '(with center ', 34 \ '(as h2 (string-upcase ,ti)))', 35 \ '(brs 3)', 36 \ ',@body))))', 37 \ '', 38 \ ';;; Utilities for generating links', 39 \ '', 40 \ '(defmacro with-link (dest &rest body)', 41 \ '`(progn', 42 \ '(format t "<a href=\"~A\">" (html-file ,dest))', 43 \ ',@body', 44 \ '(princ "</a>")))' 45 \ ]) 46 call assert_equal(7, lispindent(2)) 47 call assert_equal(5, 6->lispindent()) 48 call assert_equal(-1, lispindent(-1)) 49 50 set lisp 51 set lispwords& 52 let save_copt = &cpoptions 53 set cpoptions+=p 54 normal 1G=G 55 56 call assert_equal([ 57 \ '(defun html-file (base)', 58 \ ' (format nil "~(~A~).html" base))', 59 \ '', 60 \ '(defmacro page (name title &rest body)', 61 \ ' (let ((ti (gensym)))', 62 \ ' `(with-open-file (*standard-output*', 63 \ ' (html-file ,name)', 64 \ ' :direction :output', 65 \ ' :if-exists :supersede)', 66 \ ' (let ((,ti ,title))', 67 \ ' (as title ,ti)', 68 \ ' (with center ', 69 \ ' (as h2 (string-upcase ,ti)))', 70 \ ' (brs 3)', 71 \ ' ,@body))))', 72 \ '', 73 \ ';;; Utilities for generating links', 74 \ '', 75 \ '(defmacro with-link (dest &rest body)', 76 \ ' `(progn', 77 \ ' (format t "<a href=\"~A\">" (html-file ,dest))', 78 \ ' ,@body', 79 \ ' (princ "</a>")))', 80 \ '' 81 \ ], getline(1, "$")) 82 83 enew! 84 let &cpoptions=save_copt 85 set nolisp 86endfunc 87 88" vim: shiftwidth=2 sts=2 expandtab 89