~technomancy/fennel

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

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

Details
Message ID
<20200829003000.484378-1-michel@michel-slm.name>
DKIM signature
pass
Download raw message
Patch: +1 -1
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
Details
Message ID
<87v9h25m0m.fsf@hagelb.org>
In-Reply-To
<20200829003000.484378-1-michel@michel-slm.name> (view parent)
DKIM signature
missing
Download raw message
Michel Alexandre Salim <michel@michel-slm.name> writes:

> 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.

Thanks; applied and pushed!

Good luck with your packaging efforts.

-Phil
Review patch Export thread (mbox)