02-basic-execution.md done
This commit is contained in:
@@ -18,5 +18,41 @@
|
||||
"Test that the package loads successfully."
|
||||
(should (featurep 'ob-elixir)))
|
||||
|
||||
(ert-deftest ob-elixir-test-elixir-available ()
|
||||
"Test that Elixir is available."
|
||||
(should (executable-find ob-elixir-command)))
|
||||
|
||||
(ert-deftest ob-elixir-test-simple-value ()
|
||||
"Test simple value evaluation."
|
||||
(skip-unless (executable-find ob-elixir-command))
|
||||
(let ((result (ob-elixir--execute "1 + 1" 'value)))
|
||||
(should (equal "2" result))))
|
||||
|
||||
(ert-deftest ob-elixir-test-simple-output ()
|
||||
"Test simple output evaluation."
|
||||
(skip-unless (executable-find ob-elixir-command))
|
||||
(let ((result (ob-elixir--execute "IO.puts(\"hello\")" 'output)))
|
||||
(should (equal "hello" result))))
|
||||
|
||||
(ert-deftest ob-elixir-test-multiline-value ()
|
||||
"Test multiline code value evaluation."
|
||||
(skip-unless (executable-find ob-elixir-command))
|
||||
(let ((result (ob-elixir--execute "x = 10\ny = 20\nx + y" 'value)))
|
||||
(should (equal "30" result))))
|
||||
|
||||
(ert-deftest ob-elixir-test-list-result ()
|
||||
"Test list result."
|
||||
(skip-unless (executable-find ob-elixir-command))
|
||||
(let ((result (ob-elixir--execute "[1, 2, 3]" 'value)))
|
||||
(should (equal "[1, 2, 3]" result))))
|
||||
|
||||
(ert-deftest ob-elixir-test-map-result ()
|
||||
"Test map result."
|
||||
(skip-unless (executable-find ob-elixir-command))
|
||||
(let ((result (ob-elixir--execute "%{a: 1, b: 2}" 'value)))
|
||||
;; Maps are unordered in Elixir, so accept either order
|
||||
(should (or (string-match-p "%{a: 1, b: 2}" result)
|
||||
(string-match-p "%{b: 2, a: 1}" result)))))
|
||||
|
||||
(provide 'test-ob-elixir)
|
||||
;;; test-ob-elixir.el ends here
|
||||
|
||||
Reference in New Issue
Block a user