Download:
child 40:ad0bca5aeecc
parent 38:a0523ef47e09
39:bb3fd0111e75
Anton Shestakov <av6@dwimlabs.net>, Mon, 24 Oct 2016 00:41:04 +0800
spec: test runcommand_co()

1 файлов изменено, 18 вставок(+), 0 удалений(-) [+]
spec/hglib_spec.lua file | annotate | diff | comparison | revisions
--- a/spec/hglib_spec.lua Sun Oct 23 18:04:08 2016 +0800
+++ b/spec/hglib_spec.lua Mon Oct 24 00:41:04 2016 +0800
@@ -111,4 +111,22 @@
end
client:close()
end)
+
+ it('can use runcommand_co to request version', function()
+ local client = hglib.Client.open()
+ local co, err = client:runcommand_co({'version'})
+ assert.is_not_nil(co)
+ assert.are_equal('thread', type(co))
+ assert.are_equal('suspended', coroutine.status(co))
+ assert.is_nil(err)
+ local channels = {}
+ while coroutine.status(co) ~= 'dead' do
+ local status, channel = coroutine.resume(co)
+ assert.is_true(status)
+ table.insert(channels, channel)
+ end
+ client:close()
+ assert.are_equal('o', channels[1])
+ assert.are_equal('r', channels[#channels])
+ end)
end)