Skip to content

Commit

Permalink
test: Add "require fnl creates cache" test
Browse files Browse the repository at this point in the history
  • Loading branch information
rktjmp committed Jan 2, 2022
1 parent f0ca021 commit 0e0e8df
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 1 deletion.
1 change: 1 addition & 0 deletions test/require_a_fnl_file/my_file.fnl
@@ -0,0 +1 @@
{:value 0}
8 changes: 8 additions & 0 deletions test/require_a_fnl_file/test.lua
@@ -0,0 +1,8 @@
local t = require("my_file")

-- actually check value cause exit(nil) probaby == 0
if t.value == 0 then
os.exit(0)
else
os.exit(1)
end
16 changes: 16 additions & 0 deletions test/require_a_fnl_file/test.sh
@@ -0,0 +1,16 @@
#!/usr/bin/env bash

# place test file to into runtime
cp $2/my_file.fnl /config/fnl/my_file.fnl

cat <<EOF | assert "can import a fennel file without crashing"
/test/nvim.sh $1 || fail "could not import fennel file"
EOF

cat <<EOF | assert "imported file is in cache"
if [[ ! -f /root/.cache/nvim/hotpot/config/fnl/my_file.lua ]]; then
exa --tree -a /root/.cache/nvim/hotpot >> /run.log
fail "no cache file created"
fi
EOF

2 changes: 1 addition & 1 deletion test/require_hotpot/test.sh
@@ -1,5 +1,5 @@
#!/usr/bin/env bash

cat <<EOF | assert "require(hotpot) does not crash"
/test/nvim.sh require_hotpot || fail
/test/nvim.sh $1 || fail
EOF

0 comments on commit 0e0e8df

Please sign in to comment.