Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 6b02fb63cc
Fetching contributors…

Cannot retrieve contributors at this time

74 lines (44 sloc) 1.544 kb

This is a bunch of functions to mock core Emacs Lisp objects for testing purposes.

fakir-file &rest args

Make a fakir-file, a struct.

fakir-mock-file fakir-file &rest body

Mock the filesystem with the fakir-file object.

The Emacs Lisp file operations are flet'd so that they operate on the fakir-file.

For example:

 (fakir-mock-file (//fakir-file//
                     :filename "README"
                     :directory "/home/emacs/fakir")
    (expand-file-name "~/fakir/README"))
 => "/home/emacs/fakir/README"

The operations that are supported by the fleted functions are: `file-attributes', `file-exists-pand `expand-file-name. Others will be added as necessary.

fakir-mock-process process-bindings &rest body

Allow easier testing by mocking the process functions.

For example:

 (fakir-mock-process (:elnode-http-params
                     (:elnode-http-method "GET")
                     (:elnode-http-query "a=10"))
   (should (equal 10 (elnode-http-param 't "a")))
   )

Causes:

 (process-get anything :elnode-http-method)

to always return "GET".

`process-put' is also remapped, currently to swallow any setting.

`process-buffer' is also remapped, to deliver the value of the key :buffer if present and a dummy buffer otherwise.

We return what the body returned.

fakir-test-mock-process

A very quick function to test mocking process macro.

fakir-time-encode time-str

Encode the time-str as an EmacsLisp time.

Jump to Line
Something went wrong with that request. Please try again.