033_lisp_indent_spec.lua 1.9 KB

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