Fixed memory() and RET usage
This commit is contained in:
@@ -174,3 +174,4 @@ class TestFunctionParser(TestUsingMemoryBasedSheerka):
|
||||
assert isinstance(concept.compiled["b"], list)
|
||||
for item in concept.compiled["b"]:
|
||||
assert sheerka.isinstance(item, BuiltinConcepts.RETURN_VALUE)
|
||||
|
||||
|
||||
@@ -1154,6 +1154,30 @@ class TestSyaNodeParser(TestUsingMemoryBasedSheerka):
|
||||
assert context.sheerka.isinstance(wrapper, BuiltinConcepts.PARSER_RESULT)
|
||||
assert lexer_nodes == expected_array
|
||||
|
||||
@pytest.mark.parametrize("text, expected_result", [
|
||||
("a plus b", [CN("plus", source="a plus b")]),
|
||||
("suffixed a plus b", [CN("suffixed", source="suffixed a plus b")]),
|
||||
])
|
||||
def test_i_can_almost_parse_concept_definition(self, text, expected_result):
|
||||
"""
|
||||
In these examples, 'a' and 'b' are not defined.
|
||||
So the status of the return value cannot be True
|
||||
:param text:
|
||||
:param expected_result:
|
||||
:return:
|
||||
"""
|
||||
sheerka, context, parser = self.init_parser()
|
||||
|
||||
res = parser.parse(context, ParserInput(text))
|
||||
|
||||
wrapper = res.body
|
||||
lexer_nodes = res.body.body
|
||||
|
||||
expected_array = compute_expected_array(cmap, text, expected_result)
|
||||
assert not res.status
|
||||
assert context.sheerka.isinstance(wrapper, BuiltinConcepts.PARSER_RESULT)
|
||||
assert lexer_nodes == expected_array
|
||||
|
||||
@pytest.mark.parametrize("text, expected_concept, expected_unrecognized", [
|
||||
("x$!# prefixed", "prefixed", ["a"]),
|
||||
("suffixed x$!#", "suffixed", ["a"]),
|
||||
|
||||
Reference in New Issue
Block a user