;;; test-ob-elixir-results.el --- Result formatting tests -*- lexical-binding: t; -*- ;;; Commentary: ;; Result formatting and table support tests for ob-elixir package. ;;; Code: (require 'ert) (require 'ob-elixir) ;;; Parsing Tests (ert-deftest ob-elixir-test-parse-simple-list () "Test parsing simple list result." (should (equal '(1 2 3) (ob-elixir--table-or-string "[1, 2, 3]")))) (ert-deftest ob-elixir-test-parse-nested-list () "Test parsing nested list (table) result." (should (equal '((1 2) (3 4)) (ob-elixir--table-or-string "[[1, 2], [3, 4]]")))) (ert-deftest ob-elixir-test-parse-tuple () "Test parsing tuple result." (should (equal '(1 2 3) (ob-elixir--table-or-string "{1, 2, 3}")))) (ert-deftest ob-elixir-test-parse-scalar () "Test that scalars are returned as strings." (should (equal "42" (ob-elixir--table-or-string "42"))) (should (equal ":ok" (ob-elixir--table-or-string ":ok")))) (ert-deftest ob-elixir-test-parse-string () "Test parsing string result." (should (equal "\"hello\"" (ob-elixir--table-or-string "\"hello\"")))) (ert-deftest ob-elixir-test-sanitize-table-nil () "Test that nil values are sanitized in tables." (let ((ob-elixir-nil-to 'hline)) (should (equal '((1 hline) (hline 2)) (ob-elixir--sanitize-table '((1 nil) (nil 2))))))) (ert-deftest ob-elixir-test-execution-returns-table () "Test that list results become tables." (skip-unless (executable-find ob-elixir-command)) (let ((result (ob-elixir--table-or-string (ob-elixir--execute "[[1, 2], [3, 4]]" 'value)))) (should (equal '((1 2) (3 4)) result)))) (ert-deftest ob-elixir-test-mixed-list () "Test parsing mixed-type list." (skip-unless (executable-find ob-elixir-command)) (let ((result (ob-elixir--table-or-string (ob-elixir--execute "[1, \"two\", :three]" 'value)))) (should (listp result)) (should (= 3 (length result))))) (provide 'test-ob-elixir-results) ;;; test-ob-elixir-results.el ends here