2015-04-06 00:59:55 +00:00
|
|
|
;;; core-spacemacs-buffer-ftest.el --- Spacemacs Unit Test File
|
|
|
|
;;
|
2018-01-04 07:00:25 +00:00
|
|
|
;; Copyright (c) 2012-2018 Sylvain Benner & Contributors
|
2015-04-06 00:59:55 +00:00
|
|
|
;;
|
|
|
|
;; Author: Sylvain Benner <sylvain.benner@gmail.com>
|
|
|
|
;; URL: https://github.com/syl20bnr/spacemacs
|
|
|
|
;;
|
|
|
|
;; This file is not part of GNU Emacs.
|
|
|
|
;;
|
|
|
|
(require 'core-spacemacs-buffer)
|
|
|
|
|
2016-10-29 02:04:42 +00:00
|
|
|
(setq-default fill-column 80
|
|
|
|
spacemacs-buffer--window-width 75)
|
2015-04-06 00:59:55 +00:00
|
|
|
|
|
|
|
;; ---------------------------------------------------------------------------
|
2016-10-27 16:02:59 +00:00
|
|
|
;; spacemacs-buffer//notes-render-framed-text
|
2015-04-06 00:59:55 +00:00
|
|
|
;; ---------------------------------------------------------------------------
|
|
|
|
|
|
|
|
(defvar test-text
|
|
|
|
"Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.")
|
|
|
|
|
|
|
|
(ert-deftest test-render-framed-text--msg-width-caption-and-padding ()
|
2016-10-27 16:02:59 +00:00
|
|
|
(should (equal (spacemacs-buffer//notes-render-framed-text test-text "Caption" "Botcaption" 4 32 32)
|
|
|
|
"╭─ Caption ────────────────────╮
|
2015-07-31 01:33:28 +00:00
|
|
|
│ │
|
2016-10-27 16:02:59 +00:00
|
|
|
│ Lorem ipsum dolor sit │
|
|
|
|
│ amet, consectetur │
|
|
|
|
│ adipiscing elit, sed │
|
|
|
|
│ do eiusmod tempor │
|
|
|
|
│ incididunt ut labore │
|
|
|
|
│ et dolore magna │
|
2015-07-31 01:33:28 +00:00
|
|
|
│ aliqua. │
|
|
|
|
│ │
|
2016-10-27 16:02:59 +00:00
|
|
|
╰─ Botcaption ─────────────────╯
|
|
|
|
"
|
2015-07-31 01:33:28 +00:00
|
|
|
)))
|
2015-04-06 00:59:55 +00:00
|
|
|
|
|
|
|
(ert-deftest test-render-framed-text--msg-width-caption-no-padding ()
|
2016-10-27 16:02:59 +00:00
|
|
|
(should (equal (spacemacs-buffer//notes-render-framed-text test-text "Caption" "Botcaption" nil 32 32)
|
|
|
|
"╭─ Caption ────────────────────╮
|
2015-07-31 01:33:28 +00:00
|
|
|
│ │
|
2016-10-27 16:02:59 +00:00
|
|
|
│ Lorem ipsum dolor sit amet, │
|
2015-07-31 01:33:28 +00:00
|
|
|
│ consectetur adipiscing elit, │
|
2016-10-27 16:02:59 +00:00
|
|
|
│ sed do eiusmod tempor │
|
|
|
|
│ incididunt ut labore et │
|
2015-07-31 01:33:28 +00:00
|
|
|
│ dolore magna aliqua. │
|
|
|
|
│ │
|
2016-10-27 16:02:59 +00:00
|
|
|
╰─ Botcaption ─────────────────╯
|
|
|
|
"
|
2015-07-31 01:33:28 +00:00
|
|
|
)))
|
2015-04-06 00:59:55 +00:00
|
|
|
|
|
|
|
(ert-deftest test-render-framed-text--msg-width-no-caption-no-padding ()
|
2016-10-27 16:02:59 +00:00
|
|
|
(should (equal (spacemacs-buffer//notes-render-framed-text test-text nil nil nil 32 32)
|
2015-07-31 01:33:28 +00:00
|
|
|
"╭──────────────────────────────╮
|
|
|
|
│ │
|
2016-10-27 16:02:59 +00:00
|
|
|
│ Lorem ipsum dolor sit amet, │
|
2015-07-31 01:33:28 +00:00
|
|
|
│ consectetur adipiscing elit, │
|
2016-10-27 16:02:59 +00:00
|
|
|
│ sed do eiusmod tempor │
|
|
|
|
│ incididunt ut labore et │
|
2015-07-31 01:33:28 +00:00
|
|
|
│ dolore magna aliqua. │
|
|
|
|
│ │
|
|
|
|
╰──────────────────────────────╯"
|
|
|
|
)))
|
2015-04-06 00:59:55 +00:00
|
|
|
|
|
|
|
(ert-deftest test-render-framed-text--msg-no-width-no-caption-no-padding ()
|
2016-10-27 16:02:59 +00:00
|
|
|
(should (equal (spacemacs-buffer//notes-render-framed-text test-text)
|
|
|
|
"╭─────────────────────────────────────────────────────────────────────────╮
|
|
|
|
│ │
|
|
|
|
│ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod │
|
|
|
|
│ tempor incididunt ut labore et dolore magna aliqua. │
|
|
|
|
│ │
|
|
|
|
╰─────────────────────────────────────────────────────────────────────────╯"
|
2015-07-31 01:33:28 +00:00
|
|
|
)))
|
2015-04-06 00:59:55 +00:00
|
|
|
|
|
|
|
(ert-deftest test-render-framed-text--msg-short-text ()
|
2016-10-27 16:02:59 +00:00
|
|
|
(should (equal (spacemacs-buffer//notes-render-framed-text "Short content.")
|
|
|
|
"╭────────────────╮
|
|
|
|
│ │
|
|
|
|
│ Short content. │
|
|
|
|
│ │
|
|
|
|
╰────────────────╯"
|
2015-07-31 01:33:28 +00:00
|
|
|
)))
|
2015-04-06 00:59:55 +00:00
|
|
|
|
|
|
|
(ert-deftest test-render-framed-text--msg-several-paragraphs ()
|
2016-10-27 16:02:59 +00:00
|
|
|
(should (equal (spacemacs-buffer//notes-render-framed-text
|
2015-04-06 00:59:55 +00:00
|
|
|
(concat "\n"
|
|
|
|
test-text "\n\n\n"
|
|
|
|
test-text "\n\n"
|
2016-10-27 16:02:59 +00:00
|
|
|
test-text "\n"))
|
|
|
|
"╭─────────────────────────────────────────────────────────────────────────╮
|
|
|
|
│ │
|
|
|
|
│ │
|
|
|
|
│ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod │
|
|
|
|
│ tempor incididunt ut labore et dolore magna aliqua. │
|
|
|
|
│ │
|
|
|
|
│ │
|
|
|
|
│ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod │
|
|
|
|
│ tempor incididunt ut labore et dolore magna aliqua. │
|
|
|
|
│ │
|
|
|
|
│ Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod │
|
|
|
|
│ tempor incididunt ut labore et dolore magna aliqua. │
|
|
|
|
│ │
|
|
|
|
│ │
|
|
|
|
╰─────────────────────────────────────────────────────────────────────────╯"
|
2015-07-31 01:33:28 +00:00
|
|
|
)))
|
2015-04-06 00:59:55 +00:00
|
|
|
|
|
|
|
(ert-deftest test-render-framed-text--file-caption-and-padding ()
|
2016-10-27 16:02:59 +00:00
|
|
|
(should (equal (spacemacs-buffer//notes-render-framed-text
|
2015-07-31 08:30:42 +00:00
|
|
|
(concat spacemacs-test-directory "core/data/framed-text.txt")
|
2016-10-27 16:02:59 +00:00
|
|
|
"Caption" "Botcaption" 4 62 62)
|
|
|
|
"╭─ Caption ──────────────────────────────────────────────────╮
|
2015-07-31 01:33:28 +00:00
|
|
|
│ │
|
2016-10-27 16:02:59 +00:00
|
|
|
│ Lorem ipsum dolor sit amet, consectetur adipiscing │
|
|
|
|
│ elit, sed do eiusmod tempor incididunt ut labore et │
|
|
|
|
│ dolore magna aliqua. Ut enim ad minim veniam, quis │
|
2015-07-31 01:33:28 +00:00
|
|
|
│ nostrud exercitation ullamco laboris nisi ut aliquip │
|
2016-10-27 16:02:59 +00:00
|
|
|
│ ex ea commodo consequat. Duis aute irure dolor in │
|
|
|
|
│ reprehenderit in voluptate velit esse cillum dolore │
|
|
|
|
│ eu fugiat nulla pariatur. Excepteur sint occaecat │
|
|
|
|
│ cupidatat non proident, sunt in culpa qui officia │
|
2015-07-31 01:33:28 +00:00
|
|
|
│ deserunt mollit anim id est laborum. │
|
|
|
|
│ │
|
2016-10-27 16:02:59 +00:00
|
|
|
╰─ Botcaption ───────────────────────────────────────────────╯
|
|
|
|
"
|
2015-07-31 01:33:28 +00:00
|
|
|
)))
|