robin/laufey
git clone https://git.robinwobin.dev/robin/laufey
f907614088
master
1-- Test for 'lisp' 2-- If the lisp feature is not enabled, this will fail! 3 4local n =require ( 'test.functional.testnvim' )() 5local t =require ( 'test.testutil' ) 6 7local describe , it , setup =t . describe , t . it , t . setup 8local clear , feed , insert =n . clear , n . feed , n . insert 9local command , expect =n . command , n . expect 10local poke_eventloop =n . poke_eventloop 11 12describe ( 'lisp indent' , function () 13setup ( clear ) 14 15-- luacheck: ignore 621 (Indentation) 16it ( 'is working' , function () 17insert ( [[ 18(defun html-file (base) 19(format nil "~(~A~).html" base)) 20 21(defmacro page (name title &rest body) 22(let ((ti (gensym))) 23`(with-open-file (*standard-output* 24(html-file ,name) 25:direction :output 26:if-exists :supersede) 27(let ((,ti ,title)) 28(as title ,ti) 29(with center 30(as h2 (string-upcase ,ti))) 31(brs 3) 32,@body)))) 33 34;;; Utilities for generating links 35 36(defmacro with-link (dest &rest body) 37`(progn 38(format t "<a href=\"~A\">" (html-file ,dest)) 39,@body 40(princ "</a>")))]] ) 41 42command ( 'set lisp' ) 43command ( '/^(defun' ) 44feed ( '=G:/^(defun/,$yank A<cr>' ) 45poke_eventloop () 46 47-- Put @a and clean empty line 48command ( '%d' ) 49command ( '0put a' ) 50command ( '$d' ) 51 52-- Assert buffer contents. 53expect ( [[ 54(defun html-file (base) 55(format nil "~(~A~).html" base)) 56 57(defmacro page (name title &rest body) 58(let ((ti (gensym))) 59`(with-open-file (*standard-output* 60(html-file ,name) 61:direction :output 62:if-exists :supersede) 63(let ((,ti ,title)) 64(as title ,ti) 65(with center 66(as h2 (string-upcase ,ti))) 67(brs 3) 68,@body)))) 69 70;;; Utilities for generating links 71 72(defmacro with-link (dest &rest body) 73`(progn 74(format t "<a href=\"~A\">" (html-file ,dest)) 75,@body 76(princ "</a>")))]] ) 77end ) 78end )