From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms1.migadu.com with LMTPS id mPRzOzq5M2bx/AAA62LTzQ:P1 (envelope-from ) for ; Thu, 02 May 2024 18:03:07 +0200 Received: from aspmx1.migadu.com ([2001:41d0:303:e224::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1.migadu.com with LMTPS id mPRzOzq5M2bx/AAA62LTzQ (envelope-from ) for ; Thu, 02 May 2024 18:03:07 +0200 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=adamkovic.org header.s=fm1 header.b="n mjYoA3"; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=WfGZoJy6; dmarc=pass (policy=none) header.from=adamkovic.org; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Seal: i=1; s=key1; d=yhetil.org; t=1714665786; a=rsa-sha256; cv=none; b=KZaJ+uzJAIQAQssMt2BcYqUMTujN/LH4DFhy+weUt88C97L9xbtbIrCoFwXPCy7wqPNJ51 Yo2RNr+fN8bVePAZhQnHghzRR4XvQ5idw9pZiUajnt3kX2rbT+A3VodoDkuLI4z75ZElwz 4gAbKCingZ0bm9dzJRNqajG4fmrKvaZTafItZBTFqISPclENsBBQngfra/Cs6KFzpEMSvd WvWy2FeN+FicTx80n++p3+MYtihB4CPvRoO6e+y0cUegMYMXlt2qoXd1YjVDKVPkymksOt LZxeMj2KtGpLHy9dAFdqqkzzvCi+7WO+It8NYi+JPUYd9T5ydD/76XOT5+YNIw== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=adamkovic.org header.s=fm1 header.b="n mjYoA3"; dkim=pass header.d=messagingengine.com header.s=fm3 header.b=WfGZoJy6; dmarc=pass (policy=none) header.from=adamkovic.org; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1714665786; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=jv1AcCTFaCTHLeY7hvnQb+CFjNZwV47fTWL+t11ZCsg=; b=NFf01c2XDKqlfnRTu/xSaJx1GvdqDRa4PC/UEVRh0l5rQ+tnYOYVCRT4F3MmltT0JZQWzk Y+bARjnIfR80xOKHqtOamfTajp0nWijKeNRD0HmS40U/8ekKSFa2VfW02h8DZWl6LbSLjb cfCveDGDzk8Hsgev7c0VcwNnJEUmywfdwLZ3PNTFRHAUjoGgtJEAcibBvs6IkrxHPqV3Pt x675+OVIlVwyFJprhMmM5PpY/PVFEh3q8aFz2PVj7jy3+JoSby7M4NW5CmQ3vPNOKv9MSf LgSybifGypjOyKd9xI9J/6hE1zbQxMLiat1HsV4n+2DmfvTYcYUS8wsRnD8G0g== Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 9C67935239 for ; Thu, 2 May 2024 18:03:06 +0200 (CEST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1s2YtP-0005LP-M5; Thu, 02 May 2024 12:02:43 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s2YtN-0005Ii-KF for emacs-orgmode@gnu.org; Thu, 02 May 2024 12:02:41 -0400 Received: from fout2-smtp.messagingengine.com ([103.168.172.145]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1s2YtK-0004CL-2p for emacs-orgmode@gnu.org; Thu, 02 May 2024 12:02:41 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailfout.nyi.internal (Postfix) with ESMTP id 8EF4E138038C; Thu, 2 May 2024 12:02:36 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Thu, 02 May 2024 12:02:36 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adamkovic.org; h=cc:cc:content-type:content-type:date:date:from:from :in-reply-to:in-reply-to:message-id:mime-version:references :reply-to:subject:subject:to:to; s=fm1; t=1714665756; x= 1714752156; bh=jv1AcCTFaCTHLeY7hvnQb+CFjNZwV47fTWL+t11ZCsg=; b=n mjYoA3k2gwEKqrcZXIO9oJgT/i0kdsoyjX1OlfW30zs9xqPRxK23g6QbftmkQ6td w1hqHRinfy3+A2aW4rfQ6IuB6ol9xm0R03MSxTiq6bUcifwpawPitcO4ogn570qt 49ZJ5oxcn3iFrEqkGKjysRg6uvAG921mjOLoJTdH5ocK/4+5f406tQNw3gA85+SI kHEZJOD3VaDE0cSDY3PzIE2mS0/wmnDwZAeKeK2/sgYqjHlN7hGekP+dnZp0gGFM rZRXMBPMbveH1mE/xUgiGFPO3KkPgD9erVAVUK4tRcsUVQHJKlL0KGN5JHDxJ1Qu WuCdXleSlUHutfX1P10QA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-type:content-type:date:date :feedback-id:feedback-id:from:from:in-reply-to:in-reply-to :message-id:mime-version:references:reply-to:subject:subject:to :to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; t=1714665756; x=1714752156; bh=jv1AcCTFaCTHLeY7hvnQb+CFjNZw V47fTWL+t11ZCsg=; b=WfGZoJy632JEhCnBedJMufZjDY161+66U3L4lGAFm5yO S7ySBcxD6d5zk4bSHBCxi0Y8qtwTRoVeWfS8XXuJnb96RWtTTmdIVp8KPEeC2Fb3 tqdRfLeRX/uMnPu4cRe8zuz1V8sbp3F2C2WlvGRlk7M6QC3orDcXJgl4nUE7Hx9D fX+HHsDgClFU+7lSFp6bgDn0RY2D50nzu7aH7OdYeVy94GFeg/iwC9Kh/Gj4kVSP zjklyscvzk0FltqYTM5u7X7+S7A4Mbo7OOqmqfIkk+q38/jvKLLo9HzDyMQn/031 dDe/NdR0bZfKHtp5bZCiSxlalVCiSL6hyitUWu96/Q== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedvledrvddukedgleejucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvfevufgjfhffkfggtgesmhdtre ertddtjeenucfhrhhomheptfhuugholhhfucetuggrmhhkohhvihgtuceorhhuugholhhf segruggrmhhkohhvihgtrdhorhhgqeenucggtffrrghtthgvrhhnpeevkeekhfeuvdethe dtjeejheduleduueeliedugfegveefjeekjeevtdetlefgveenucevlhhushhtvghrufhi iigvpedtnecurfgrrhgrmhepmhgrihhlfhhrohhmpehruhguohhlfhesrggurghmkhhovh hitgdrohhrgh X-ME-Proxy: Feedback-ID: i88214938:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 2 May 2024 12:02:35 -0400 (EDT) From: Rudolf =?utf-8?Q?Adamkovi=C4=8D?= To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: [PATCH] ob-lua: Support all types and multiple values in results In-Reply-To: References: <20240423164458.33702-1-rudolf@adamkovic.org> <8734raewr6.fsf@localhost> <87pluctf6m.fsf@localhost> <87il01k6k1.fsf@localhost> <874jbjywq3.fsf@localhost> Date: Thu, 02 May 2024 18:02:34 +0200 Message-ID: MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=103.168.172.145; envelope-from=rudolf@adamkovic.org; helo=fout2-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Queue-Id: 9C67935239 X-Migadu-Scanner: mx12.migadu.com X-Migadu-Spam-Score: -10.57 X-Spam-Score: -10.57 X-TUID: ElFS+jJBV1UU --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Rudolf Adamkovi=C4=8D writes: > I am attaching a V2 of the patch that: Oops, I forgot to attach the patch. Here it is. :) Rudy --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-ob-lua-Quote-list-like-strings-sort-tables-and-parse.patch >From b4d61bf511df74094fbcdf13c8c0c2b57b1e4a22 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rudolf=20Adamkovi=C4=8D?= Date: Mon, 29 Apr 2024 21:42:04 +0200 Subject: [PATCH] ob-lua: Quote list-like strings, sort tables, and parse bare returns * lisp/ob-lua.el (org-babel-lua-wrapper-method): 3 changes: (1) Quote strings with list-like content to prevent Org Babel from incorrectly guessing their type, (2) sort pretty-printed non-sequential tables to make them reproducible, and (3) handle implicit nils produced by 'return' used with no arguments. * testing/lisp/test-ob-lua.el (test-ob-lua/result/nil): (test-ob-lua/result/nil/explicit): (test-ob-lua/result/boolean): (test-ob-lua/results/number/integer): (test-ob-lua/results/number/integer/negative): (test-ob-lua/results/number/integer/multiple): (test-ob-lua/results/number/real): (test-ob-lua/results/number/real/multiple): (test-ob-lua/results/number/infinity): (test-ob-lua/results/string/single-quotes): (test-ob-lua/results/string/double-quotes): (test-ob-lua/results/string/multiple): (test-ob-lua/results/string/list-like): (test-ob-lua/results/string/list-like/brackets): (test-ob-lua/results/string/list-like/curlies): (test-ob-lua/results/string/list-like/standard-output): (test-ob-lua/result/table): (test-ob-lua/result/table/pretty-print): (test-ob-lua/result/table/pretty-print/sorted): (test-ob-lua/results/value-separator): New tests. --- lisp/ob-lua.el | 49 +++++-- testing/lisp/test-ob-lua.el | 278 ++++++++++++++++++++++++++++++++---- 2 files changed, 284 insertions(+), 43 deletions(-) diff --git a/lisp/ob-lua.el b/lisp/ob-lua.el index 041abfabc..19950f2cb 100644 --- a/lisp/ob-lua.el +++ b/lisp/ob-lua.el @@ -254,33 +254,40 @@ then create. Return the initialized session." (defvar org-babel-lua-wrapper-method " function main() -%s + %s end function dump(it, indent) if indent == nil then indent = '' end + if type(it) == 'table' and %s then - local count = 0 - for _ in pairs(it) do - count = count + 1 - end local result = '' + if #indent ~= 0 then result = result .. '\\n' end - for key, value in pairs(it) do + + local keys = {} + for key in pairs(it) do + table.insert(keys, key) + end + + table.sort(keys) + + for index, key in pairs(keys) do + local value = it[key] result = result .. indent .. dump(key) .. ' = ' .. dump(value, indent .. ' ') - count = count - 1 - if count ~= 0 then + if index ~= #keys then result = result .. '\\n' end end + return result else return tostring(it) @@ -288,11 +295,27 @@ function dump(it, indent) end function combine(...) - local result = {} - for index = 1, select('#', ...) do - result[index] = dump(select(index, ...)) - end - return table.concat(result, '%s') + local quotes = '\"' + local result = {} + + for index = 1, select('#', ...) do + result[index] = dump(select(index, ...)) + end + + if #result == 0 then + return dump(nil) + end + + if #result == 1 then + local value = result[1] + if string.find(value, '[%%(%%[{]') == 1 then + return quotes .. value .. quotes + else + return value + end + end + + return quotes .. table.concat(result, '%s') .. quotes end output = io.open('%s', 'w') diff --git a/testing/lisp/test-ob-lua.el b/testing/lisp/test-ob-lua.el index 0a60c68ca..a0a3b178c 100644 --- a/testing/lisp/test-ob-lua.el +++ b/testing/lisp/test-ob-lua.el @@ -136,45 +136,263 @@ return x (org-babel-next-src-block) (org-babel-execute-src-block))))) -(ert-deftest test-ob-lua/types () - "Test returning different types." +(ert-deftest test-ob-lua/result/nil () + "Test returning nothing." (should - (equal "nil" - (org-test-with-temp-text "src_lua{return nil}" - (org-babel-execute-src-block)))) + (equal + "src_lua{return} {{{results(=nil=)}}}" + (org-test-with-temp-text "src_lua{return}" + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max)))))) + +(ert-deftest test-ob-lua/result/nil/explicit () + "Test returning nothing explicitly." + (should + (equal + "src_lua{return nil} {{{results(=nil=)}}}" + (org-test-with-temp-text "src_lua{return nil}" + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max)))))) + +(ert-deftest test-ob-lua/result/boolean () + "Test returning the boolean values true and false." + (should + (equal + "src_lua{return true} {{{results(=true=)}}}" + (org-test-with-temp-text "src_lua{return true}" + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max))))) + (should + (equal + "src_lua{return false} {{{results(=false=)}}}" + (org-test-with-temp-text "src_lua{return false}" + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max)))))) + +(ert-deftest test-ob-lua/results/number/integer () + "Test returning integers." + (should + (equal + "src_lua{return 1} {{{results(=1=)}}}" + (org-test-with-temp-text "src_lua{return 1}" + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max)))))) + +(ert-deftest test-ob-lua/results/number/integer/negative () + "Test returning negative integers." (should - (equal "true" - (org-test-with-temp-text "src_lua{return true}" - (org-babel-execute-src-block)))) + (equal + "src_lua{return -1} {{{results(=-1=)}}}" + (org-test-with-temp-text "src_lua{return -1}" + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max)))))) + +(ert-deftest test-ob-lua/results/number/integer/multiple () + "Test returning multiple integers at once." + (should + (equal + "src_lua{return 1, 2, 3} {{{results(=1, 2, 3=)}}}" + (org-test-with-temp-text "src_lua{return 1, 2, 3}" + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max)))))) + +(ert-deftest test-ob-lua/results/number/real () + "Test returning real numbers." + (should + (equal + "src_lua{return 1.5} {{{results(=1.5=)}}}" + (org-test-with-temp-text "src_lua{return 1.5}" + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max)))))) + +(ert-deftest test-ob-lua/results/number/real/multiple () + "Test returning multiple real numbers at once." (should - (equal "false" - (org-test-with-temp-text "src_lua{return false}" - (org-babel-execute-src-block)))) + (equal + "src_lua{return 1.5, 2.5, 3.5} {{{results(=1.5, 2.5, 3.5=)}}}" + (org-test-with-temp-text "src_lua{return 1.5, 2.5, 3.5}" + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max)))))) + +(ert-deftest test-ob-lua/results/number/infinity () + "Test returning the infinity." (should - (equal 1 - (org-test-with-temp-text "src_lua{return 1}" - (org-babel-execute-src-block)))) + (equal + "src_lua{return 1 / 0} {{{results(=inf=)}}}" + (org-test-with-temp-text "src_lua{return 1 / 0}" + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max)))))) + +(ert-deftest test-ob-lua/results/string/single-quotes () + "Test returning strings in single quotes." (should - (equal "hello world" - (org-test-with-temp-text "src_lua{return 'hello world'}" - (org-babel-execute-src-block)))) + (equal + "src_lua{return 'hello world'} {{{results(=hello world=)}}}" + (org-test-with-temp-text "src_lua{return 'hello world'}" + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max)))))) + +(ert-deftest test-ob-lua/results/string/double-quotes () + "Test returning strings in double quotes." (should - (equal 0 - (string-match "table: 0x[0-9A-F]+" - (org-test-with-temp-text "src_lua{return {}}" - (org-babel-execute-src-block)))))) + (equal + "src_lua{return \"hello world\"} {{{results(=hello world=)}}}" + (org-test-with-temp-text "src_lua{return \"hello world\"}" + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max)))))) -(ert-deftest test-ob-lua/multiple-values () - "Test returning multiple values." +(ert-deftest test-ob-lua/results/string/multiple () + "Test returning multiple strings at once." (should - (equal "1, 2, 3" - (org-test-with-temp-text "src_lua{return 1, 2, 3}" - (org-babel-execute-src-block)))) + (equal + "src_lua{return 'a', 'b'} {{{results(=a, b=)}}}" + (org-test-with-temp-text "src_lua{return 'a', 'b'}" + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max)))))) + +(ert-deftest test-ob-lua/results/string/list-like () + "Test returning strings that look like \"(...)\" lists." + (should + (equal + (concat "src_lua{return string.match('A (B) C', '%b()')}" + " {{{results(=(B)=)}}}") + (org-test-with-temp-text + "src_lua{return string.match('A (B) C', '%b()')}" + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max)))))) + +(ert-deftest test-ob-lua/results/string/list-like/brackets () + "Test returning strings that look like \"[...]\" lists." + (should + (equal + (concat "src_lua{return string.match('A [B] C', '%b[]')}" + " {{{results(=[B]=)}}}") + (org-test-with-temp-text + "src_lua{return string.match('A [B] C', '%b[]')}" + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max)))))) + +(ert-deftest test-ob-lua/results/string/list-like/curlies () + "Test returning strings that look like \"{...}\" lists." + (should + (equal + (concat "src_lua{return string.match('A {B} C', '%b{}')}" + " {{{results(={B}=)}}}") + (org-test-with-temp-text + "src_lua{return string.match('A {B} C', '%b{}')}" + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max)))))) + +(ert-deftest test-ob-lua/results/string/list-like/standard-output () + "Test returning strings that look like lists to standard output." + (should + (equal + (concat "src_lua[:results output]" + "{print(string.match('A (B) C', '%b()'))}" + " {{{results(=(B)=)}}}") + (org-test-with-temp-text + (concat "src_lua[:results output]" + "{print(string.match('A (B) C', '%b()'))}") + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max)))))) + +(ert-deftest test-ob-lua/result/table () + "Test returning table references." + (should + (equal + 0 + (string-match + "src_lua{return {}} {{{results(=table: 0x[0-9A-F]+=)}}}" + (org-test-with-temp-text "src_lua{return {}}" + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max))))))) + +(ert-deftest test-ob-lua/result/table/pretty-print () + "Test returning and pretty-printing sequential tables." + (should + (equal (string-join + '("#+BEGIN_SRC lua :results pp" + "return {10, {20, 30, {40, 50}, 60}, 70}" + "#+END_SRC" + "" + "#+RESULTS:" + ": 1 = 10" + ": 2 = " ; FIXME Trailing space. + ": 1 = 20" + ": 2 = 30" + ": 3 = " ; FIXME Trailing space. + ": 1 = 40" + ": 2 = 50" + ": 4 = 60" + ": 3 = 70" + "") + "\n") + (org-test-with-temp-text + (string-join + '("#+BEGIN_SRC lua :results pp" + "return {10, {20, 30, {40, 50}, 60}, 70}" + "#+END_SRC") + "\n") + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max)))))) + +(ert-deftest test-ob-lua/result/table/pretty-print/sorted () + "Test returning and pretty-printing non-sequential tables." + (should + (equal (string-join + '("#+BEGIN_SRC lua :results pp" + "return {b = 20, c = 30, a = 10}" + "#+END_SRC" + "" + "#+RESULTS:" + ;; NOTE The keys are sorted alphabetically. + ": a = 10" + ": b = 20" + ": c = 30" + "") + "\n") + (org-test-with-temp-text + (string-join + '("#+BEGIN_SRC lua :results pp" + "return {b = 20, c = 30, a = 10}" + "#+END_SRC") + "\n") + (org-babel-execute-src-block) + (buffer-substring-no-properties (point-min) + (point-max)))))) + +(ert-deftest test-ob-lua/results/value-separator () + "Test customizing the separator of multiple values." + ;; TODO Once Org Babel supports returning lists from inline blocks, + ;; instead of trapping with the user error: "Inline error: list + ;; result cannot be used", use those for multiple values. (should - (equal "1|2|3" - (let ((org-babel-lua-multiple-values-separator "|")) - (org-test-with-temp-text "src_lua{return 1, 2, 3}" - (org-babel-execute-src-block)))))) + (equal + "src_lua{return 1, 2, 3} {{{results(=1\t2\t3=)}}}" + (org-test-with-temp-text "src_lua{return 1, 2, 3}" + (let ((org-babel-lua-multiple-values-separator "\t")) + (org-babel-execute-src-block)) + (buffer-substring-no-properties (point-min) + (point-max)))))) (provide 'test-ob-lua) -- 2.39.3 (Apple Git-146) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable --=20 =E2=80=9CThose who cannot remember the past are condemned to repeat it.=E2= =80=9D --- George Santayana, Life of Reason: Reason in Common Sense, 1905 Rudolf Adamkovi=C4=8D [he/him] Studenohorsk=C3=A1 25, 84103 Bratislava, Slovakia, European Union --=-=-=--