Here are the things that are important to me:
A (large) Emacs Lisp program uses modules from many places. Some modules reside inside and some outside.
Example: location positioning might be such a thing.
Interestingly the very old language, C, got it right. Consider:
#include "stdio.h"
which can also be written as:
#include "./stdio.h"
versus:
#include <stdio.h>
In Ruby 1.9 and above:
require "my_module"
versus:
require_relative "my_module"
In Emacs Lisp we have load-path which is consulted in load() and require().
Problems with load-path:
load-path
("/home/rocky/.emacs.d/elpa/load-relative-20190601.1221"
"/home/rocky/.emacs.d/elpa/lsp-mode-20190601.2003"
"/home/rocky/.emacs.d/elpa/load-relative-20190531.2319"
"/home/rocky/.emacs.d/elpa/lsp-mode-20190531.1911"
"/home/rocky/.emacs.d/elpa/slime-20190531.1534/contrib"
...)
(length load-path) => 185
I wrote load-relative for internal linking. It is available on ELPA and MELPA.
In its simplest form:
(require 'load-relative) ;; pull in library
(require-relative "my-module")
(require-relative "./my-module") ;; same as above
(require-relative-list '("my-module-a" "my-module-b"))
;; The above is the same as:
(require-relative "my-module-a")
(require-relative "my-module-b")
Schools of Testing:
Some Test frameworks.
I have 66 test files for over 100 Emacs Lisp files. This is more than Emacs 24 using elr.
Let's now dive into a test. This one is from testing test-simple itself:
(load-file "../test-simple.el")
(test-simple-start "test-simple.el")
(note "basic-tests")
(assert-t (memq 'test-simple features) "'test-simple provided")
(assert-nil nil "Knights of ni")
(assert-equal 5 (+ 1 4) "assert-equal")
(assert-raises error (error "you should not see this") "assert-raises")
(end-tests)
Inside GNU Emacs
M-x eval-current-buffer
Inside buffer *test-simple*
we have:
test-simple.el
....
0 failures in 4 assertions (0.00102626 seconds)
Inside a POSIX shell terminal:
$ # after ./configure && make
$ make check-short
make -C test check 2>&1 | ruby make-check-filter.rb
test-simple.el
....
0 failures in 4 assertions (0.000122467 seconds)
..
0 failures in 2 assertions (0.00157458 seconds)
.....
0 failures in 5 assertions (0.000479297 seconds)