Re: test-equal: actual returned value is #f when tested expression raises execption divoplade (20 Feb 2021 16:28 UTC)

Re: test-equal: actual returned value is #f when tested expression raises execption divoplade 20 Feb 2021 11:26 UTC

Hello,

This is what I understand from guile. I am no expert, so maybe it is
not 100% accurate!

Le samedi 20 février 2021 à 12:03 +0100, Jérémy Korwin-Zmijowski a
écrit :
>
> Running `guile -L . char-sets-test.scm` in the file location will
> produce the following output :
>
>    $ guile -L . char-sets-test.scm
>    ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
>    ;;;       or pass the --no-auto-compile argument to disable.
>    ;;; compiling /tmp/char-sets-test.scm
>    ;;; WARNING: compilation of /tmp/char-sets-test.scm failed:
>    ;;; no code for module (char-sets)

From now on, char-sets-test.scm has been compiled, but guile did not
find password-valid?, so it assumed that this function will be
available at run time when needed. Maybe some crazy macro expansion,
who knows?
>
> And now, I rerun the tests :
>
> $ guile -L . char-sets-test.scm
> ;;; note: auto-compilation is enabled, set GUILE_AUTO_COMPILE=0
> ;;;       or pass the --no-auto-compile argument to disable.
> ;;; compiling /tmp/char-sets-test.scm
> ;;; compiling ./char-sets.scm
> ;;; compiled /home/jeko/.cache/guile/ccache/3.0-LE-8-4.4/tmp/char-
> sets.scm.go
> ;;; char-sets-test.scm:10:2: warning: possibly unbound variable
> `password-valid?'
> ;;; compiled /home/jeko/.cache/guile/ccache/3.0-LE-8-4.4/tmp/char-
> sets-
> test.scm.go
> %%%% Starting test harness-char-sets  (Writing full log to "harness-
> char-sets.log")
> # of expected passes      1

Guile did not re-compile the test, because the code did not change, but
remembered from last time that password-valid? was potentially missing,
so it issues the warning again when loading the bytecode. However,
since now there's a char-sets.scm, it can use the module and find the
function, and everything works correctly.

Everything works because guile does not inline code from a module to
another. So the warning is just a warning. You don't need to worry.