Skip to content
This repository


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

functions and macros to fake bit of Emacs core libraries, like files and processes.

tree: b064236838

Fetching latest commit…


Cannot retrieve the latest commit at this time

Octocat-spinner-32 README.creole
Octocat-spinner-32 fakir.el

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")))


 (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.


A very quick function to test mocking process macro.

fakir-time-encode time-str

Encode the time-str as an EmacsLisp time.

Something went wrong with that request. Please try again.