Compare commits
4 Commits
Start_Stop
...
24366ee7f8
| Author | SHA1 | Date | |
|---|---|---|---|
| 24366ee7f8 | |||
| 3c9d9816fb | |||
| 6f832cd67b | |||
| ff46886865 |
@@ -9,9 +9,9 @@ This element is of the following form:
|
|||||||
- let:
|
- let:
|
||||||
name: Let Item
|
name: Let Item
|
||||||
values:
|
values:
|
||||||
key1: value1
|
- key1: value1
|
||||||
key2: value2
|
- key2: value2
|
||||||
key3: <| $(variable)[$(loop_index)] |>
|
- key3: <| $(variable)[$(loop_index)] |>
|
||||||
|
|
||||||
The ``let`` element is used to set values in the global directory.
|
The ``let`` element is used to set values in the global directory.
|
||||||
|
|
||||||
|
|||||||
@@ -51,8 +51,8 @@ The parameter file can be specified in the `.tum` file root:
|
|||||||
:caption: configuration files definition in the main `.tum` test file
|
:caption: configuration files definition in the main `.tum` test file
|
||||||
|
|
||||||
config_file:
|
config_file:
|
||||||
config1.yaml
|
- config1.yaml
|
||||||
config2.yaml
|
- config2.yaml
|
||||||
|
|
||||||
main:
|
main:
|
||||||
name: Test example
|
name: Test example
|
||||||
|
|||||||
@@ -300,7 +300,7 @@ class TestItemConsoleReadUntil(TestItemConsoleAction):
|
|||||||
def execute(self):
|
def execute(self):
|
||||||
cons = self.get_console()
|
cons = self.get_console()
|
||||||
ru = self._prms.expanse(self._read_until)
|
ru = self._prms.expanse(self._read_until)
|
||||||
read_timeout = int(self._prms.getParam("timeout", default=-1, processed=True))
|
read_timeout = float(self._prms.getParam("timeout", default=-1, processed=True))
|
||||||
mute = self._prms.getParam("mute", default=False, processed=True)
|
mute = self._prms.getParam("mute", default=False, processed=True)
|
||||||
if read_timeout < 0:
|
if read_timeout < 0:
|
||||||
read_timeout = None
|
read_timeout = None
|
||||||
|
|||||||
@@ -41,8 +41,7 @@ end
|
|||||||
--- INTERNAL: Handle requests from the client
|
--- INTERNAL: Handle requests from the client
|
||||||
function JSONRPC:_handle_request(req)
|
function JSONRPC:_handle_request(req)
|
||||||
local method = self.methods[req.method]
|
local method = self.methods[req.method]
|
||||||
local ok, ret
|
local ok, ret, err
|
||||||
local res, err
|
|
||||||
if not method then
|
if not method then
|
||||||
if req.id then self:_send_error(req.id, string.format("Method '%s' not registered in lua server")) end
|
if req.id then self:_send_error(req.id, string.format("Method '%s' not registered in lua server")) end
|
||||||
return
|
return
|
||||||
@@ -52,15 +51,18 @@ function JSONRPC:_handle_request(req)
|
|||||||
|
|
||||||
-- Only send response if it's not a Notification (notifications have no ID)
|
-- Only send response if it's not a Notification (notifications have no ID)
|
||||||
if req.id then
|
if req.id then
|
||||||
if ok then
|
if not ok then
|
||||||
res = ret
|
-- pcall trapped a runtime error in the method itself.
|
||||||
if res == nil then
|
self:_send_error(req.id, tostring(ret))
|
||||||
|
elseif err ~= nil then
|
||||||
|
-- Method ran but signaled a logical error via its 2nd return.
|
||||||
self:_send_error(req.id, tostring(err))
|
self:_send_error(req.id, tostring(err))
|
||||||
else
|
else
|
||||||
self:_send({ jsonrpc = "2.0", result = { returned_value = res }, id = req.id })
|
-- Success. A user function returning nothing yields ret==nil;
|
||||||
end
|
-- encode it as JSON null so "returned_value" stays present.
|
||||||
else
|
local val = ret
|
||||||
self:_send_error(req.id, tostring(err))
|
if val == nil then val = json.null end
|
||||||
|
self:_send({ jsonrpc = "2.0", result = { returned_value = val }, id = req.id })
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -84,7 +84,18 @@
|
|||||||
- read_until: {expected: HelloConsole, timeout: 1, mute: true}
|
- read_until: {expected: HelloConsole, timeout: 1, mute: true}
|
||||||
|
|
||||||
- console:
|
- console:
|
||||||
name: Console read_until muted
|
name: Console read_until float timeout
|
||||||
|
console_name: term
|
||||||
|
key: $(test)_PASS
|
||||||
|
steps:
|
||||||
|
- writeln: echo "HelloConsole"
|
||||||
|
{% if os == "Windows" %}
|
||||||
|
- read_until: {expected: echo "HelloConsole", timeout: 0.2}
|
||||||
|
{% endif %}
|
||||||
|
- read_until: {expected: HelloConsole, timeout: 0.2}
|
||||||
|
|
||||||
|
- console:
|
||||||
|
name: Console read_until process result
|
||||||
console_name: term
|
console_name: term
|
||||||
key: $(test)_PASS
|
key: $(test)_PASS
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@@ -11,8 +11,8 @@
|
|||||||
- let:
|
- let:
|
||||||
name: Let it be
|
name: Let it be
|
||||||
values:
|
values:
|
||||||
it: $(loop_param)
|
- it: $(loop_param)
|
||||||
be: <| $(loop_param) == $(it) |>
|
- be: <| $(loop_param) == $(it) |>
|
||||||
|
|
||||||
- loop:
|
- loop:
|
||||||
name: Cycle iterating on list
|
name: Cycle iterating on list
|
||||||
|
|||||||
@@ -49,4 +49,12 @@ function module.test_delgd()
|
|||||||
return 0
|
return 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function module.return_nothing()
|
||||||
|
-- Returns no value: ret is nil but no error.
|
||||||
|
end
|
||||||
|
|
||||||
|
function module.return_explicit_nil()
|
||||||
|
return nil
|
||||||
|
end
|
||||||
|
|
||||||
return module
|
return module
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
- let:
|
- let:
|
||||||
name: lua_func test constants,
|
name: lua_func test constants,
|
||||||
values:
|
values:
|
||||||
lua_func test parameter: test parameter lua_func
|
- lua_func test parameter: test parameter lua_func
|
||||||
|
|
||||||
- lua_func:
|
- lua_func:
|
||||||
name: fail lua_func
|
name: fail lua_func
|
||||||
@@ -186,6 +186,18 @@
|
|||||||
file: $(test_path)$(psep)lua_func.lua
|
file: $(test_path)$(psep)lua_func.lua
|
||||||
func_name: test_delgd
|
func_name: test_delgd
|
||||||
|
|
||||||
|
- lua_func:
|
||||||
|
name: function returning nothing should succeed
|
||||||
|
key: $(test)_PASS
|
||||||
|
file: $(test_path)$(psep)lua_func.lua
|
||||||
|
func_name: return_nothing
|
||||||
|
|
||||||
|
- lua_func:
|
||||||
|
name: function returning explicit nil should succeed
|
||||||
|
key: $(test)_PASS
|
||||||
|
file: $(test_path)$(psep)lua_func.lua
|
||||||
|
func_name: return_explicit_nil
|
||||||
|
|
||||||
- group:
|
- group:
|
||||||
name: context_id tests
|
name: context_id tests
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@@ -54,3 +54,10 @@ def test_delgd():
|
|||||||
tm.delgd("_py_delgd_test")
|
tm.delgd("_py_delgd_test")
|
||||||
assert tm.gd("_py_delgd_test", None) is None
|
assert tm.gd("_py_delgd_test", None) is None
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
|
def return_nothing():
|
||||||
|
# Falls off the end: implicit None return, no error.
|
||||||
|
pass
|
||||||
|
|
||||||
|
def return_explicit_none():
|
||||||
|
return None
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
- let:
|
- let:
|
||||||
name: py_func test constants,
|
name: py_func test constants,
|
||||||
values:
|
values:
|
||||||
py_func test parameter: test parameter
|
- py_func test parameter: test parameter
|
||||||
|
|
||||||
- py_func:
|
- py_func:
|
||||||
name: pass py_func
|
name: pass py_func
|
||||||
@@ -196,6 +196,18 @@
|
|||||||
file: $(test_path)$(psep)py_func.py
|
file: $(test_path)$(psep)py_func.py
|
||||||
func_name: test_delgd
|
func_name: test_delgd
|
||||||
|
|
||||||
|
- py_func:
|
||||||
|
name: function returning nothing should succeed
|
||||||
|
key: $(test)_PASS
|
||||||
|
file: $(test_path)$(psep)py_func.py
|
||||||
|
func_name: return_nothing
|
||||||
|
|
||||||
|
- py_func:
|
||||||
|
name: function returning explicit None should succeed
|
||||||
|
key: $(test)_PASS
|
||||||
|
file: $(test_path)$(psep)py_func.py
|
||||||
|
func_name: return_explicit_none
|
||||||
|
|
||||||
- group:
|
- group:
|
||||||
name: context_id tests
|
name: context_id tests
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
@@ -31,7 +31,11 @@ main:
|
|||||||
|
|
||||||
{% for item in items %}
|
{% for item in items %}
|
||||||
# item test
|
# item test
|
||||||
- let: {name: {{ item }} test constants, values: {test: {{ item }}, test_path: items/$(test)}}
|
- let:
|
||||||
|
name: {{ item }} test constants
|
||||||
|
values:
|
||||||
|
- test: {{ item }}
|
||||||
|
- test_path: items/$(test)
|
||||||
- group:
|
- group:
|
||||||
name: {{ item }} test
|
name: {{ item }} test
|
||||||
steps:
|
steps:
|
||||||
|
|||||||
Reference in New Issue
Block a user