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:
|
||||
name: Let Item
|
||||
values:
|
||||
key1: value1
|
||||
key2: value2
|
||||
key3: <| $(variable)[$(loop_index)] |>
|
||||
- key1: value1
|
||||
- key2: value2
|
||||
- key3: <| $(variable)[$(loop_index)] |>
|
||||
|
||||
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
|
||||
|
||||
config_file:
|
||||
config1.yaml
|
||||
config2.yaml
|
||||
- config1.yaml
|
||||
- config2.yaml
|
||||
|
||||
main:
|
||||
name: Test example
|
||||
|
||||
@@ -300,7 +300,7 @@ class TestItemConsoleReadUntil(TestItemConsoleAction):
|
||||
def execute(self):
|
||||
cons = self.get_console()
|
||||
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)
|
||||
if read_timeout < 0:
|
||||
read_timeout = None
|
||||
|
||||
@@ -41,8 +41,7 @@ end
|
||||
--- INTERNAL: Handle requests from the client
|
||||
function JSONRPC:_handle_request(req)
|
||||
local method = self.methods[req.method]
|
||||
local ok, ret
|
||||
local res, err
|
||||
local ok, ret, err
|
||||
if not method then
|
||||
if req.id then self:_send_error(req.id, string.format("Method '%s' not registered in lua server")) end
|
||||
return
|
||||
@@ -52,15 +51,18 @@ function JSONRPC:_handle_request(req)
|
||||
|
||||
-- Only send response if it's not a Notification (notifications have no ID)
|
||||
if req.id then
|
||||
if ok then
|
||||
res = ret
|
||||
if res == nil then
|
||||
self:_send_error(req.id, tostring(err))
|
||||
else
|
||||
self:_send({ jsonrpc = "2.0", result = { returned_value = res }, id = req.id })
|
||||
end
|
||||
else
|
||||
if not ok then
|
||||
-- pcall trapped a runtime error in the method itself.
|
||||
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))
|
||||
else
|
||||
-- Success. A user function returning nothing yields ret==nil;
|
||||
-- encode it as JSON null so "returned_value" stays present.
|
||||
local val = ret
|
||||
if val == nil then val = json.null end
|
||||
self:_send({ jsonrpc = "2.0", result = { returned_value = val }, id = req.id })
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -84,7 +84,18 @@
|
||||
- read_until: {expected: HelloConsole, timeout: 1, mute: true}
|
||||
|
||||
- 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
|
||||
key: $(test)_PASS
|
||||
steps:
|
||||
|
||||
@@ -11,8 +11,8 @@
|
||||
- let:
|
||||
name: Let it be
|
||||
values:
|
||||
it: $(loop_param)
|
||||
be: <| $(loop_param) == $(it) |>
|
||||
- it: $(loop_param)
|
||||
- be: <| $(loop_param) == $(it) |>
|
||||
|
||||
- loop:
|
||||
name: Cycle iterating on list
|
||||
|
||||
@@ -49,4 +49,12 @@ function module.test_delgd()
|
||||
return 0
|
||||
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
|
||||
@@ -1,7 +1,7 @@
|
||||
- let:
|
||||
name: lua_func test constants,
|
||||
values:
|
||||
lua_func test parameter: test parameter lua_func
|
||||
- lua_func test parameter: test parameter lua_func
|
||||
|
||||
- lua_func:
|
||||
name: fail lua_func
|
||||
@@ -186,6 +186,18 @@
|
||||
file: $(test_path)$(psep)lua_func.lua
|
||||
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:
|
||||
name: context_id tests
|
||||
steps:
|
||||
|
||||
@@ -54,3 +54,10 @@ def test_delgd():
|
||||
tm.delgd("_py_delgd_test")
|
||||
assert tm.gd("_py_delgd_test", None) is None
|
||||
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:
|
||||
name: py_func test constants,
|
||||
values:
|
||||
py_func test parameter: test parameter
|
||||
- py_func test parameter: test parameter
|
||||
|
||||
- py_func:
|
||||
name: pass py_func
|
||||
@@ -196,6 +196,18 @@
|
||||
file: $(test_path)$(psep)py_func.py
|
||||
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:
|
||||
name: context_id tests
|
||||
steps:
|
||||
|
||||
@@ -31,7 +31,11 @@ main:
|
||||
|
||||
{% for item in items %}
|
||||
# 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:
|
||||
name: {{ item }} test
|
||||
steps:
|
||||
|
||||
Reference in New Issue
Block a user