~subsetpark/bagatto

37b87a808c37b933f5d830bff18d352130f64c06 — Zach Smith 6 months ago 6cc2366
Add thread init test
3 files changed, 22 insertions(+), 3 deletions(-)

M src/env.janet
A test/core.janet
M test/require.janet
M src/env.janet => src/env.janet +0 -1
@@ 1,5 1,4 @@
(import temple)
(import sh)

(def required-checks @{})
(def exec-blacklist @{})

A test/core.janet => test/core.janet +21 -0
@@ 0,0 1,21 @@
(import testament :prefix "" :exit true)
(import src/core)

(defn- test-temple []
  (require "test/support/test"))

(defn- test-bagatto [] (eval 'bagatto/json-data))

(deftest thread-init
  (def run (fn [parent]
             (test-temple)
             (test-bagatto)
             (:send parent :tests-pass)))
  
  (assert-thrown (test-temple))
  (assert-thrown (test-bagatto))
  
  (core/thread-init run)
  (is (= (thread/receive) :tests-pass)))

(run-tests!)

M test/require.janet => test/require.janet +1 -2
@@ 13,7 13,6 @@
  (env/defrequire "this-application-cannot-be-found" should-fail [] :ok)
  (env/prepare-root-env!)
  (env/setdyn-blacklist!)
  (assert-thrown 
   (should-fail)))
  (assert-thrown (should-fail)))

(run-tests!)