1
0
mirror of https://github.com/janet-lang/janet synced 2025-09-10 06:46:08 +00:00

Add integer parsing to pegs.

This commit is contained in:
Calvin Rose
2020-09-27 12:18:12 -05:00
parent 0a1d902f46
commit 45feb55483
7 changed files with 122 additions and 7 deletions

View File

@@ -11,9 +11,12 @@
(default e "assert error")
(++ num-tests-run)
(when x (++ num-tests-passed))
(def str (string e))
(def truncated
(if (> (length e) 40) (string (string/slice e 0 35) "...") (string e)))
(if x
(xprintf stdout "\e[32m✔\e[0m %s: %v" (string e) x)
(xprintf stdout "\n\e[31m✘\e[0m %s: %v" (string e) x))
(xprintf stdout "\e[32m✔\e[0m %s: %v" truncated x)
(xprintf stdout "\n\e[31m✘\e[0m %s: %v" truncated x))
x)
(defmacro assert-error