init repo
This commit is contained in:
commit
174258c611
11 changed files with 11589 additions and 0 deletions
43
minify_test.bb
Normal file
43
minify_test.bb
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
(ns minify-test
|
||||
(:require [clojure.test :refer [deftest is testing run-tests]]))
|
||||
|
||||
(load-file "minify.bb")
|
||||
(refer 'minify :only '[tokenize emit short-name-seq])
|
||||
|
||||
(deftest test-tokenize
|
||||
(is (= [{:type :open-paren, :value "("}
|
||||
{:type :symbol, :value "+"}
|
||||
{:type :space, :value nil}
|
||||
{:type :symbol, :value "1"}
|
||||
{:type :space, :value nil}
|
||||
{:type :symbol, :value "1"}
|
||||
{:type :close-paren, :value ")"}
|
||||
{:type :space, :value nil}
|
||||
{:type :comment, :value "; how to add"}
|
||||
{:type :space, :value nil}
|
||||
{:type :open-paren, :value "("}
|
||||
{:type :symbol, :value "var"}
|
||||
{:type :space, :value nil}
|
||||
{:type :symbol, :value "name"}
|
||||
{:type :space, :value nil}
|
||||
{:type :open-paren, :value "("}
|
||||
{:type :symbol, :value ".."}
|
||||
{:type :space, :value nil}
|
||||
{:type :string, :value "\"jane\""}
|
||||
{:type :space, :value nil}
|
||||
{:type :string, :value "\"doe\""}
|
||||
{:type :close-paren, :value ")"}
|
||||
{:type :close-paren, :value ")"}]
|
||||
|
||||
(tokenize "(+ 1 1) ; how to add\n(var name (.. \"jane\" \"doe\"))"))))
|
||||
|
||||
(deftest test-short-name-seq
|
||||
(let [short-names (vec (take 1000 (short-name-seq)))]
|
||||
(is (= (get short-names 0) "a"))
|
||||
(is (= (get short-names 1) "b"))
|
||||
(is (= (get short-names 25) "z"))
|
||||
(is (= (get short-names 26) "aa"))
|
||||
(is (= (get short-names 345) "hhhhhhhhhhhhhh"))
|
||||
(is (= (get short-names 733) "fffffffffffffffffffffffffffff"))))
|
||||
|
||||
(run-tests 'minify-test)
|
||||
Loading…
Add table
Add a link
Reference in a new issue