-
-
Notifications
You must be signed in to change notification settings - Fork 114
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
94 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
(local {: describe : it} (require :plenary.busted)) | ||
(local assert (require :luassert.assert)) | ||
(local a (require :nfnl.core)) | ||
(local uuid (require :conjure.uuid)) | ||
|
||
(describe "uuid" | ||
(fn [] | ||
;; Helper: Is word in xs? | ||
(fn is-in [word xs] | ||
(a.some (fn [x] (= word x)) xs)) | ||
|
||
(describe "turns a UUID" | ||
(fn [] | ||
(it "into something human-readable" | ||
(fn [] | ||
(assert.are.equals "Wirehaired Pointing Griffon" | ||
(uuid.pretty "c7ef277c-160c-45f4-a5c3-03ac16a93788") | ||
))) | ||
(it "into something human-readable but wrong string" | ||
(fn [] | ||
(assert.are.not.equals "Wirehaired Pointing Griffon" | ||
(uuid.pretty "d7ef277c-160c-45f4-a5c3-03ac16a93788") | ||
))))) | ||
|
||
(describe "generated UUID" | ||
(fn [] | ||
(it "is turned into something human-readable" | ||
(fn [] | ||
(assert.are.equals true | ||
(is-in (uuid.pretty (uuid.v4)) | ||
uuid.cats-and-dogs)))) | ||
(it "has the correct format" | ||
(fn [] | ||
(assert.are.not.equals nil | ||
(string.match (uuid.v4) | ||
"^%x+-%x+-%x+-%x+-%x+$")))))))) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.