liminix/pkgs/ifwait/test-ifwait.fnl

22 lines
471 B
Text
Raw Normal View History

2024-03-05 00:06:03 +01:00
(local fennel (require :fennel))
(fn event-generator [events]
(coroutine.wrap
(fn []
(each [_ e (ipairs events)] (coroutine.yield e)))))
(fn file-events [path]
(let [data (with-open [e (io.open path "r")] (e:read "*a"))
2024-03-05 00:06:03 +01:00
parse (fennel.parser data)]
(icollect [_ ast parse]
ast)))
2024-03-05 00:06:03 +01:00
(set _G.arg (doto ["-v" "dummy0" "up"] (tset 0 "test")))
2024-03-05 00:06:03 +01:00
(local ifwait (require :ifwait))
(ifwait.run #(event-generator (file-events "events-fixture")))