From c9d14bc80fbd56b5d6dda483414f44c855440628 Mon Sep 17 00:00:00 2001 From: Vishal Date: Fri, 5 Jul 2024 02:43:08 +0530 Subject: [PATCH] Tests added for selector expression Signed-off-by: Vishal --- test/corpus/expr.txt | 87 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) diff --git a/test/corpus/expr.txt b/test/corpus/expr.txt index 029f27c..8a4f3d8 100644 --- a/test/corpus/expr.txt +++ b/test/corpus/expr.txt @@ -43,6 +43,93 @@ Index expression (string_end)) (integer))) +================================================================================ +Selector expression +================================================================================ + +schema Person: + name: str + age: int + +person = Person { + name = "Alice" + age = 18 +} +name = person.name # "Alice" +age = person.age # 18 + +myDict = { + key = "value" +} +result = myDict.key # "value" + +-------------------------------------------------------------------------------- + +(module + (schema_statement + (identifier) + (block + (assignment + (dotted_name + (identifier)) + (basic_type)) + (assignment + (dotted_name + (identifier)) + (basic_type)))) + (assignment + (dotted_name + (identifier)) + (schema_expr + (identifier) + (dict_expr + (pair + (attribute + (identifier)) + (string + (string_start) + (string_content) + (string_end))) + (pair + (attribute + (identifier)) + (integer))))) + (assignment + (dotted_name + (identifier)) + (dotted_name + (identifier) + (identifier))) + (comment) + (assignment + (dotted_name + (identifier)) + (dotted_name + (identifier) + (identifier))) + (comment) + (assignment + (dotted_name + (identifier)) + (config_expr + (config_entries + (config_entry + (test + (dotted_name + (identifier))) + (test + (string + (string_start) + (string_content) + (string_end))))))) + (assignment + (dotted_name + (identifier)) + (dotted_name + (identifier) + (identifier))) + (comment)) + ================================================================================ slice expression ================================================================================