Skip to content

Commit d2142a0

Browse files
committed
Add function impostman-version
1 parent ef35c35 commit d2142a0

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

impostman.el

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,15 @@ Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ="
8686

8787
;; utility functions
8888

89+
(defun impostman-version (&optional print-dest)
90+
"Return the Impostman version.
91+
92+
PRINT-DEST is the output stream, by default the echo area.
93+
94+
With \\[universal-argument] prefix, output is in the current buffer."
95+
(interactive (list (if current-prefix-arg (current-buffer) t)))
96+
(princ (format "impostman %s" impostman-version) print-dest))
97+
8998
(defun impostman-format-comment (comment &optional prefix)
9099
"Format a comment, which can be on multiple lines.
91100

tests/impostman-test.el

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,15 @@
4141
(insert-file-contents filename)
4242
(buffer-string)))
4343

44+
(ert-deftest impostman-test-version ()
45+
"Test Impostman version."
46+
(let ((impostman-version-output (impostman-version))
47+
(expected-string-version (concat "impostman " impostman-version)))
48+
;; version must include at least 3 digits, separated by dots
49+
(should (string-match "^impostman [0-9]+\\.[0-9]+\\.[0-9]+"
50+
impostman-version-output))
51+
(should (equal impostman-version-output expected-string-version))))
52+
4453
(ert-deftest impostman-test-format-comment ()
4554
"Test the format of comment."
4655
;; without prefix: default is "# "

0 commit comments

Comments
 (0)