~technomancy/fennel

Handle Fedora Lua's different error truncation behavior v1 PROPOSED

Michel Alexandre Salim: 1
 Handle Fedora Lua's different error truncation behavior

 1 files changed, 1 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~technomancy/fennel/patches/12172/mbox | git am -3
Learn more about email & git
View this thread in the archives

[PATCH] Handle Fedora Lua's different error truncation behavior Export this patch

One of the Fennel core tests intentionally throws an error and tries
to match it against an expected value.

This breaks on Fedora's `lua` (but works with `luajit`) since the
truncation behavior is different.
Tighten up the match so it passes on both `lua` and `luajit`.

```
  fennel on  master
  ❯ lua test/init.lua | grep -E "not ok|#  "
  not ok 9        test-core
  #   test/core.fnl:49: (fn b [] (each [e {}] (e))) (let [(_ e) (pcall b)] (e:match ":1.*"))
  #   expected: ":1: attempt to call a table value"
  #   actual: ':1.*"))"]:1: attempt to call a table value'

  fennel on  master
  ❯ luajit test/init.lua | grep -E "not ok|#  "

  fennel on  master
  ❯ rpm -q lua luajit
  lua-5.3.5-7.fc32.x86_64
  luajit-2.1.0-0.17beta3.fc32.x86_64
```

```
  fennel on  fix-tests-for-fedora-lua took 14s
  ❯ lua test/init.lua | grep -E "not ok|#  "

  fennel on  fix-tests-for-fedora-lua
  ❯ luajit test/init.lua | grep -E "not ok|#  "
```

Signed-off-by: Michel Alexandre Salim <michel@michel-slm.name>
---
 test/core.fnl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/test/core.fnl b/test/core.fnl
index 5206018..9701350 100644
--- a/test/core.fnl
+++ b/test/core.fnl
@@ -126,7 +126,7 @@
               "(: {:foo (fn [self] (.. self.bar 2)) :bar :baz} :foo)" "baz2"
               "(do (tset {} :a 1) 1)" 1
               "(do (var a nil) (var b nil) (local ret (fn [] a)) (set (a b) (values 4 5)) (ret))" 4
               "(fn b [] (each [e {}] (e))) (let [(_ e) (pcall b)] (e:match \":1.*\"))" ":1: attempt to call a table value"
               "(fn b [] (each [e {}] (e))) (let [(_ e) (pcall b)] (e:match \":[1]: .*\"))" ":1: attempt to call a table value"
               "(global a_b :global) (local a-b :local) a_b" "global"
               "(global x 1) (global x 284) x" 284
               "(let [k 5 t {: k}] t.k)" 5
-- 
2.26.2
Michel Alexandre Salim <michel@michel-slm.name> writes: