;;; test-ob-elixir-results.el --- Result formatting tests -*- lexical-binding: t; -*- ;;; Commentary: ;; Result formatting tests for ob-elixir package. ;; Results are returned as plain strings without parsing into elisp structures. ;;; Code: (require 'ert) (require 'ob-elixir) ;;; Result String Tests (ert-deftest ob-elixir-test-result-list-as-string () "Test that list results are returned as strings." (should (equal "[1, 2, 3]" (ob-elixir--table-or-string "[1, 2, 3]")))) (ert-deftest ob-elixir-test-result-nested-list-as-string () "Test that nested list results are returned as strings." (should (equal "[[1, 2], [3, 4]]" (ob-elixir--table-or-string "[[1, 2], [3, 4]]")))) (ert-deftest ob-elixir-test-result-tuple-as-string () "Test that tuple results are returned as strings." (should (equal "{1, 2, 3}" (ob-elixir--table-or-string "{1, 2, 3}")))) (ert-deftest ob-elixir-test-result-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-result-string () "Test that string results are returned as-is." (should (equal "\"hello\"" (ob-elixir--table-or-string "\"hello\"")))) (ert-deftest ob-elixir-test-result-empty () "Test that empty results return nil." (should (null (ob-elixir--table-or-string ""))) (should (null (ob-elixir--table-or-string " ")))) (ert-deftest ob-elixir-test-result-whitespace-trimmed () "Test that whitespace is trimmed from results." (should (equal "42" (ob-elixir--table-or-string " 42 "))) (should (equal "[1, 2]" (ob-elixir--table-or-string "\n[1, 2]\n")))) (ert-deftest ob-elixir-test-execution-returns-string () "Test that execution results are returned as strings." (skip-unless (executable-find ob-elixir-command)) (let ((result (ob-elixir--table-or-string (ob-elixir--execute "[[1, 2], [3, 4]]" 'value)))) (should (stringp result)) (should (string-match-p "\\[\\[1, 2\\], \\[3, 4\\]\\]" result)))) (ert-deftest ob-elixir-test-mixed-list-as-string () "Test that mixed-type list results are returned as strings." (skip-unless (executable-find ob-elixir-command)) (let ((result (ob-elixir--table-or-string (ob-elixir--execute "[1, \"two\", :three]" 'value)))) (should (stringp result)))) (provide 'test-ob-elixir-results) ;;; test-ob-elixir-results.el ends here