diff options
author | Johan Claesson <[email protected]> | 2016-07-15 17:12:09 +0200 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2016-08-31 16:40:25 +0200 |
commit | b5a4c4a31e06db72b84df2c40163c2944388863a (patch) | |
tree | 58918a9758e9ca9f59a8c26f1a6829f4e7b923a5 /lib/tools/emacs/erlang-test.el | |
parent | 243a05c2474928786cf47ad06966cbf121ce8ea8 (diff) | |
download | otp-b5a4c4a31e06db72b84df2c40163c2944388863a.tar.gz otp-b5a4c4a31e06db72b84df2c40163c2944388863a.tar.bz2 otp-b5a4c4a31e06db72b84df2c40163c2944388863a.zip |
Emacs: extend support for compile options
The syntax was limited to atoms, strings and 2-tuples. This covers most
compile options but not for example {d,Macro,Value}.
Add support for N-tuples and lists.
Add a related unit test case.
Diffstat (limited to 'lib/tools/emacs/erlang-test.el')
-rw-r--r-- | lib/tools/emacs/erlang-test.el | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/lib/tools/emacs/erlang-test.el b/lib/tools/emacs/erlang-test.el index 549fae4799..adf865128f 100644 --- a/lib/tools/emacs/erlang-test.el +++ b/lib/tools/emacs/erlang-test.el @@ -132,6 +132,40 @@ concatenated to form an erlang file to test on.") (should (looking-back "erlang_test:")))) +(ert-deftest erlang-test-compile-options () + (erlang-test-format-opt t + "t") + (erlang-test-format-opt nil + "nil") + (erlang-test-format-opt (cons 1 2) + "{1, 2}") + (erlang-test-format-opt (list 1) + "[1]") + (erlang-test-format-opt (list 1 2) + "[1, 2]") + (erlang-test-format-opt (list 1 2 3) + "[1, 2, 3]") + (erlang-test-format-opt 'symbol + "symbol") + (erlang-test-format-opt "string" + "\"string\"") + (erlang-test-format-opt [] + "{}") + (erlang-test-format-opt [1] + "{1}") + (erlang-test-format-opt [1 2] + "{1, 2}") + (erlang-test-format-opt [1 2 (3 [4 5 6] 7)] + "{1, 2, [3, {4, 5, 6}, 7]}")) + +(defun erlang-test-format-opt (elisp &optional expected-erlang) + (let ((erlang (inferior-erlang-format-opt elisp))) + (message "%s -> %s" elisp erlang) + (when expected-erlang + (should (equal erlang expected-erlang))) + erlang)) + + (provide 'erlang-test) ;;; erlang-test.el ends here |