Skip to content

Commit

Permalink
test: Add test for elin.function.sexpr/get-namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
liquidz committed Mar 26, 2024
1 parent 756ae15 commit 63c6b99
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 36 deletions.
34 changes: 34 additions & 0 deletions test/elin/function/sexpr_test.clj
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
(ns elin.function.sexpr-test
(:require
[clojure.test :as t]
[elin.error :as e]
[elin.function.sexpr :as sut]
[elin.test-helper :as h]
[elin.test-helper.host]))

(t/use-fixtures :once h/malli-instrument-fixture)

(defn- get-namespace-elin
[ns-form]
(h/test-elin {:host {:get-namespace-form! ns-form}}))

(t/deftest get-namespace-test
(t/testing "no metadata"
(t/is (= "foo.bar"
(sut/get-namespace (get-namespace-elin "(ns foo.bar)")))))

(t/testing "with metadata"
(t/is (= "foo.bar"
(sut/get-namespace (get-namespace-elin "(ns ^:meta foo.bar)"))))
(t/is (= "foo.bar"
(sut/get-namespace (get-namespace-elin "(ns ^{:meta true} foo.bar)")))))

(t/testing "in-ns"
(t/is (= "foo.bar"
(sut/get-namespace (get-namespace-elin "(in-ns 'foo.bar)")))))

(t/testing "no namespace"
(t/is (e/not-found?
(sut/get-namespace (get-namespace-elin "(foo)"))))
(t/is (e/not-found?
(sut/get-namespace (get-namespace-elin ""))))))
36 changes: 0 additions & 36 deletions test/elin/function/vim/sexp_test.clj

This file was deleted.

0 comments on commit 63c6b99

Please sign in to comment.