(var runTest (lambda (name func) ((require "tape") name (lambda (t) (func t) ((. t end)))))) ; Automatically end tests (= eslc (lambda (code) (= fullCode ; wrap in a call (+ "(macro propertify (require \"./index.js\")) (propertify " code ")")) (return ((require "eslisp") fullCode)))) (macro test (lambda (name body) (return `(runTest ,name (lambda (t) ,@body))))) ; - - - (test "dot" (((. t equals) (eslc "a.b") "a.b;"))) (test "dots" (((. t equals) (eslc "a.b.c") "a.b.c;"))) (test "dot & call" (((. t equals) (eslc "(a.b 42)") "a.b(42);"))) (test "plain dot" (((. t equals) (eslc "(. a b)") "a.b;"))) (test "strings unaffected" (((. t equals) (eslc "\"a.b\"") "'a.b';"))) (test "numbers unaffected" (((. t equals) (eslc "3.2") "3.2;"))) (test "ignore start or end dots" (((. t equals) (eslc "(macro ..a (lambda () (return ((. this string) (. '.b.. value))))) (..a)") "'.b..';"))) (test "pass to other macro" (((. t equals) (eslc "(macro replace (lambda () (return 'x))) (replace (. a b))") "x;")))