Commits

Peter Szilagyi committed 599c2c5 Merge

merge

Comments (0)

Files changed (5)

elisp/core/Makefile

 	emacs -q --no-site-file -batch -l byte-compile-header.el -f batch-byte-compile $<
 
 test :
-	emacs -q --no-site-file -batch \
-	  -L . -L ~/.emacs.d/el-get/ert-expectations -L ../contrib \
-	  -l ert -l ert-expectations -l core-unit-tests \
-	  -f ert-run-tests-batch-and-exit
+	emacs -q --no-site-file -batch -L . -L ../contrib \
+	  -l core-unit-tests -f ert-run-tests-batch-and-exit
 
 .PHONY: all
 all : $(elc)

elisp/omake/Makefile

+defualt : all
 
 modules=                \
   omake-lib		\
 .SUFFIXES: .elc .el
 
 %.elc : %.el
-	emacs -q --no-site-file -batch -l ../core/byte-compile-header.el --eval "(add-to-list 'load-path \"../core\")" -f batch-byte-compile $<
+	emacs -q --no-site-file -batch -L ../core -l ../core/byte-compile-header.el -f batch-byte-compile $<
+
+test :
+	emacs -q --no-site-file -batch -L ../core -L . -l omake-unit-tests -f ert-run-tests-batch-and-exit
 
 .PHONY: all
 all : $(elc)

elisp/omake/omake-env.el

 (require 'omake-util)
 
 (defun Omake.Env.value-p (v)
-  "Environment variables are sent from ocaml as the symbols 'true and 'false"
+  "Environment variables are sent from ocaml as the symbols 'true and 'false."
   (assert (symbolp v))
   (case v
     ((true false nil) t)
     (t nil)))
 
+(defun Omake.Env.not (env)
+  (case env
+    ((true) 'false)
+    ((false nil) 'true)
+    (t (error "Omake.Env.not error: %s" env))))
+;; (Omake.Env.not "true")
+
 (defstruct
   (Omake.Env
    (:predicate Omake.Env.is)
   (limit-subdirs-for-speed nil :read-only t)
   (four-point-zero         nil :read-only t))
 
-(defun Omake.Env.not (env)
-  (case env
-    ((true) 'false)
-    ((false nil) 'true)
-    (t (error "Omake.Env.not error: %s" env))))
-;; (Omake.Env.not "true")
-
 (defun Omake.Env.completing-read ()
   (let ((vars
          '("VERSION_UTIL_SUPPORT"
     (intern (completing-read "Value: " vals nil t))))
 ;; (Omake.Env.completing-read-value)
 
-(defun Omake.Env.value (env var)
-  (assert (symbolp var))
-  (case var
-   (VERSION_UTIL_SUPPORT (Omake.Env.version-util-support env))
-   (X_LIBRARY_INLINING (Omake.Env.x-library-inlining env))
-   (LINK_EXECUTABLES (Omake.Env.link-executables env))
-   (LIMIT_SUBDIRS_FOR_SPEED (Omake.Env.limit-subdirs-for-speed env))
-   (FOUR_POINT_ZERO (Omake.Env.four-point-zero env))
-   (t (error "Omake.Env.value: Impossible: %s" var))))
-
 (defun Omake.Env.var-to-string (var val new-val)
   (unless val (setq val '<default>))
   (unless new-val (setq new-val '<default>))

elisp/omake/omake-lib.el

 (defun Omake.Window.all-visible ()
   "Return all visible windows in all visible frames."
   (apply 'append (mapcar (lambda (f) (window-list f "no-mini")) (frame-list))))
-;; (Window.all-visible)
+;; (Omake.Window.all-visible)
 
 (provide 'omake-lib)

elisp/omake/omake-unit-tests.el

+;; -*- lexical-binding: t -*-
+
+(require 'ert)
+(require 'omake-env)
+
+(ert-deftest Omake.Env.value-p ()
+  (should (Omake.Env.value-p 'true))
+  (should (Omake.Env.value-p 'false))
+  (should-not (Omake.Env.value-p t))
+  (should-not (Omake.Env.value-p nil)))
+
+(ert-deftest Omake.Env.not ()
+  (should (equal (Omake.Env.not 'true) 'false))
+  (should (equal (Omake.Env.not 'false) 'true)))
+
+(ert-deftest Omake.Env.create ()
+  (let* ((four-point-zero 'true)
+         (limit-subdirs-for-speed 'true)
+         (link-executables 'true)
+         (version-util-support 'true)
+         (x-library-inlining 'true)
+         (env (Omake.Env.create
+               :four-point-zero four-point-zero
+               :limit-subdirs-for-speed limit-subdirs-for-speed
+               :link-executables link-executables
+               :version-util-support version-util-support
+               :x-library-inlining x-library-inlining)))
+    (should (equal (Omake.Env.version-util-support env) version-util-support))
+    (should (equal (Omake.Env.limit-subdirs-for-speed env)
+                   limit-subdirs-for-speed))
+    (should (equal (Omake.Env.link-executables env) link-executables))
+    (should (equal (Omake.Env.version-util-support env) version-util-support))
+    (should (equal (Omake.Env.x-library-inlining env) x-library-inlining))))
+
+(ert-deftest Omake.Env.to-string ()
+  (let* ((four-point-zero 'true)
+         (limit-subdirs-for-speed 'true)
+         (link-executables 'true)
+         (version-util-support 'true)
+         (x-library-inlining-old 'true)
+         (x-library-inlining-new (Omake.Env.not x-library-inlining-old))
+         (env-old (Omake.Env.create
+                   :four-point-zero four-point-zero
+                   :limit-subdirs-for-speed limit-subdirs-for-speed
+                   :link-executables link-executables
+                   :version-util-support version-util-support
+                   :x-library-inlining x-library-inlining-old))
+         (env-new (Omake.Env.create
+                   :four-point-zero four-point-zero
+                   :limit-subdirs-for-speed limit-subdirs-for-speed
+                   :link-executables link-executables
+                   :version-util-support version-util-support
+                   :x-library-inlining x-library-inlining-new)))
+    (should (equal
+             (substring-no-properties (Omake.Env.to-string env-old env-new))
+             "\
+VERSION_UTIL_SUPPORT      = true
+LINK_EXECUTABLES          = true
+X_LIBRARY_INLINING        = true (on next compilation: false)
+LIMIT_SUBDIRS_FOR_SPEED   = true
+FOUR_POINT_ZERO           = true
+"))))
+
+(provide 'omake-unit-tests)