]> gitweb.factorcode.org Git - factor.git/blob - misc/fuel/fuel-tests.el
Use lexical scoping in all fuel sources
[factor.git] / misc / fuel / fuel-tests.el
1 ;;; fuel-tests.el -- unit tests for fuel -*- lexical-binding: t -*-
2
3 ;; Copyright (C) 2014 Björn Lindqvist
4 ;; See http://factorcode.org/license.txt for BSD license.
5
6 ;; Author: Björn Lindqvist <bjourne@gmail.com>
7 ;; Keywords: languages, fuel, factor
8 ;; Start date: Sat Nov 01, 2014
9
10 ;;; Commentary:
11
12 ;; Run the test suite using M-x ert RET t RET or:
13 ;;
14 ;;     emacs -batch -l ert -l misc/fuel/fuel-tests.el \
15 ;;         -f ert-run-tests-batch-and-exit
16
17 ;;; Code:
18
19 ;; Load fuel from the same directory the tests are in.
20 (add-to-list 'load-path (file-name-directory load-file-name))
21
22 (require 'ert)
23 (require 'fuel-help)
24 (require 'fuel-markup)
25 (require 'fuel-xref)
26
27 ;; fuel-markup
28 (ert-deftest print-str ()
29   (should (equal (fuel-markup--print-str "hello") "hello")))
30
31 (ert-deftest quotation ()
32   (let ((quot '($quotation (effect ("args" "kw") ("ret") nil nil nil))))
33     (should (equal
34              (with-temp-buffer
35                (fuel-markup--quotation quot)
36                (buffer-string))
37              "a quotation with stack effect ( args kw -- ret )"))))
38
39 ;; fuel-help
40 (ert-deftest find-in-w/vocabulary ()
41   (should (equal
42            (with-temp-buffer
43              (insert "Vocabulary: imap")
44              (fuel-help--find-in))
45            "imap")))
46
47 (ert-deftest find-in-w/buffer-link ()
48   (should (equal
49            (with-temp-buffer
50              (setq fuel-help--buffer-link '("foob" "foob" vocab))
51              (insert "Help page contents")
52              (fuel-help--find-in))
53            "foob")))
54
55 ;; fuel-xref
56 (ert-deftest fuel-xref-name ()
57   (should (equal (buffer-name (fuel-xref--buffer)) "*fuel xref*")))