Skip to content

Commit

Permalink
more tests added
Browse files Browse the repository at this point in the history
version bumped
  • Loading branch information
carocad committed Nov 20, 2019
1 parent 3a63a2f commit bda1494
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject carocad/parcera "0.4.3"
(defproject carocad/parcera "0.4.4"
:description "Grammar-based Clojure parser"
:url "https://github.com/carocad/parcera"
:license {:name "LGPLv3"
Expand Down
20 changes: 19 additions & 1 deletion test/parcera/test/core.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,25 @@
;(is (clear input))))
(as-> "\\ϕ" input (and (is (valid? input))
(is (roundtrip input))))))
;(is (clear input))))))


(deftest metadata
(testing "simple definitions"
(let [input ":bar"
ast (parcera/ast input)
location (meta (second ast))]
(is (= (:row (::parcera/start location)) 1))
(is (= (:column (::parcera/start location)) 0))
(is (= (:row (::parcera/start location)) 1))
(is (= (:column (::parcera/end location))
(count input)))))

(testing "syntax error"
(let [input "hello/world/"
ast (parcera/ast input)
location (meta (second ast))]
(is (parcera/failure? ast))
(is (some? (:message (::parcera/start location)))))))


(deftest data-structures
Expand Down

0 comments on commit bda1494

Please sign in to comment.