summaryrefslogtreecommitdiff
path: root/tests/modules/pipe
diff options
context:
space:
mode:
authorruki <[email protected]>2020-01-31 23:36:15 +0800
committerruki <[email protected]>2020-01-31 15:37:34 +0800
commitb1d0a3540bac162914f3fd77d2fc82b344125036 (patch)
tree651a34d553f7aaf148c0ac437c25a6a0f46982ac /tests/modules/pipe
parent6dae2cd8c6b930aea276d2b5f83a444136489531 (diff)
add pipe pair tests
Diffstat (limited to 'tests/modules/pipe')
-rw-r--r--tests/modules/pipe/pipe_pair.lua12
1 files changed, 12 insertions, 0 deletions
diff --git a/tests/modules/pipe/pipe_pair.lua b/tests/modules/pipe/pipe_pair.lua
new file mode 100644
index 000000000..de81a3133
--- /dev/null
+++ b/tests/modules/pipe/pipe_pair.lua
@@ -0,0 +1,12 @@
+import("core.base.pipe")
+
+function main()
+ local rpipe, wpipe = pipe.openpair(4096)
+ wpipe:write("hello xmake!", {block = true})
+ local read, data = rpipe:read(13)
+ if read > 0 and data then
+ data:dump()
+ end
+ rpipe:close()
+ wpipe:close()
+end