Skip to content

Commit

Permalink
Add function impostman-version
Browse files Browse the repository at this point in the history
  • Loading branch information
flashcode committed Jan 11, 2021
1 parent ef35c35 commit d2142a0
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
9 changes: 9 additions & 0 deletions impostman.el
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,15 @@ Authorization: Basic dXNlcm5hbWU6cGFzc3dvcmQ="

;; utility functions

(defun impostman-version (&optional print-dest)
"Return the Impostman version.
PRINT-DEST is the output stream, by default the echo area.
With \\[universal-argument] prefix, output is in the current buffer."
(interactive (list (if current-prefix-arg (current-buffer) t)))
(princ (format "impostman %s" impostman-version) print-dest))

(defun impostman-format-comment (comment &optional prefix)
"Format a comment, which can be on multiple lines.
Expand Down
9 changes: 9 additions & 0 deletions tests/impostman-test.el
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,15 @@
(insert-file-contents filename)
(buffer-string)))

(ert-deftest impostman-test-version ()
"Test Impostman version."
(let ((impostman-version-output (impostman-version))
(expected-string-version (concat "impostman " impostman-version)))
;; version must include at least 3 digits, separated by dots
(should (string-match "^impostman [0-9]+\\.[0-9]+\\.[0-9]+"
impostman-version-output))
(should (equal impostman-version-output expected-string-version))))

(ert-deftest impostman-test-format-comment ()
"Test the format of comment."
;; without prefix: default is "# "
Expand Down

0 comments on commit d2142a0

Please sign in to comment.