neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

033_lisp_indent_spec.lua (1906B)


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