-
-
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.
Merge pull request #600 from russtoku/nfnl-migration
More conversions
- Loading branch information
Showing
29 changed files
with
863 additions
and
1,019 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
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,21 @@ | ||
(local {: describe : it} (require :plenary.busted)) | ||
(local assert (require :luassert.assert)) | ||
(local a (require :nfnl.core)) | ||
(local stdio (require :conjure.remote.stdio)) | ||
|
||
(describe "conjure.remote.stdio" | ||
(fn [] | ||
(describe "parse-cmd" | ||
(fn [] | ||
(it "parses a string" | ||
(fn [] | ||
(assert.same {:cmd "foo" :args []} (stdio.parse-cmd "foo")))) | ||
(it "parses a list of one string" | ||
(fn [] | ||
(assert.same {:cmd "foo" :args []} (stdio.parse-cmd ["foo"])))) | ||
(it "parses a string with words separated by spaces" | ||
(fn [] | ||
(assert.same {:cmd "foo" :args ["bar" "baz"]} (stdio.parse-cmd "foo bar baz")))) | ||
(it "parses a list of more than one string" | ||
(fn [] | ||
(assert.same {:cmd "foo" :args ["bar" "baz"]} (stdio.parse-cmd ["foo" "bar" "baz"])))))))) |
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,17 @@ | ||
(local {: describe : it} (require :plenary.busted)) | ||
(local assert (require :luassert.assert)) | ||
(local b64 (require :conjure.remote.transport.base64)) | ||
|
||
(describe "conjure.remote.transport.base64" | ||
(fn [] | ||
(describe "basic" | ||
(fn [] | ||
(it "empty to empty" | ||
(fn [] | ||
(assert.are.equals "" (b64.encode "")))) | ||
(it "simple text to base64" | ||
(fn [] | ||
(assert.are.equals "SGVsbG8sIFdvcmxkIQ==" (b64.encode "Hello, World!")))) | ||
(it "base64 back to text" | ||
(fn [] | ||
(assert.are.equals "Hello, World!" (b64.decode "SGVsbG8sIFdvcmxkIQ==")))))))) |
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,68 @@ | ||
(local {: describe : it} (require :plenary.busted)) | ||
(local assert (require :luassert.assert)) | ||
(local a (require :nfnl.core)) | ||
(local bencode (require :conjure.remote.transport.bencode)) | ||
|
||
(describe "conjure.remote.transport.bencode" | ||
(fn [] | ||
(describe "basic" | ||
(fn [] | ||
(let [bs (bencode.new) | ||
data {:foo [:bar]}] | ||
(it "data starts empty" | ||
(fn [] | ||
(assert.are.equals bs.data ""))) | ||
(it "a single bencoded value" | ||
(fn [] | ||
(assert.same [data] (bencode.decode-all bs (bencode.encode data))))) | ||
(it "data is empty after a decode" | ||
(fn [] | ||
(assert.are.equals bs.data "")))))) | ||
|
||
(describe "multiple-values" | ||
(fn [] | ||
(let [bs (bencode.new) | ||
data-a {:foo [:bar]} | ||
data-b [1 2 3]] | ||
(it "data starts empty" | ||
(fn [] | ||
(assert.are.equals bs.data ""))) | ||
(it "two bencoded values" | ||
(fn [] | ||
(assert.same [data-a data-b] | ||
(bencode.decode-all | ||
bs | ||
(.. (bencode.encode data-a) | ||
(bencode.encode data-b)))))) | ||
(it "data is empty after a decode" | ||
(fn [] | ||
(assert.are.equals bs.data "")))))) | ||
|
||
(describe "partial-values" | ||
(fn [] | ||
(let [bs (bencode.new) | ||
data-a {:foo [:bar]} | ||
data-b [1 2 3] | ||
encoded-b (bencode.encode data-b)] | ||
(it "data starts empty" | ||
(fn [] | ||
(assert.are.equals bs.data ""))) | ||
(it "first value" | ||
(fn [] | ||
(assert.same [data-a] | ||
(bencode.decode-all | ||
bs | ||
(.. (bencode.encode data-a) | ||
(string.sub encoded-b 1 3)))))) | ||
(it "after first, data contains partial data-b" | ||
(fn [] | ||
(assert.are.equals "li1" bs.data))) | ||
(it "second value after rest of data" | ||
(fn [] | ||
(assert.same [data-b] | ||
(bencode.decode-all | ||
bs | ||
(string.sub encoded-b 4))))) | ||
(it "data is empty after a decode" | ||
(fn [] | ||
(assert.are.equals bs.data "")))))))) |
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
Oops, something went wrong.