aboutsummaryrefslogtreecommitdiffstats
path: root/src/tests
diff options
context:
space:
mode:
authorAndy Williams <andy@andywilliams.me>2017-11-14 19:12:56 +0000
committerAndy Williams <andy@andywilliams.me>2017-11-14 19:12:56 +0000
commit95b0d7ca68c0b5c95cacb9e7cea7c80cf7520823 (patch)
treedb77053452fbdd3711ac90a14b8a1e88af517328 /src/tests
parenteina: Improve API docs for eina_crc.h (diff)
downloadefl-95b0d7ca68c0b5c95cacb9e7cea7c80cf7520823.tar.gz
elm_code: Add basic scope parsing to syntax highlighting.
This is currently displayed by showing scope in the widget gutter
Diffstat (limited to 'src/tests')
-rw-r--r--src/tests/elementary/elm_code_test_syntax.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/tests/elementary/elm_code_test_syntax.c b/src/tests/elementary/elm_code_test_syntax.c
index f3f5c3acd9..7e1d0d13f6 100644
--- a/src/tests/elementary/elm_code_test_syntax.c
+++ b/src/tests/elementary/elm_code_test_syntax.c
@@ -116,8 +116,39 @@ START_TEST (elm_code_syntax_c)
}
END_TEST
+START_TEST (elm_code_syntax_scope_change_braces_test)
+{
+ Elm_Code_File *file;
+ Elm_Code_Line *line;
+ Elm_Code *code;
+
+ elm_init(1, NULL);
+ code = elm_code_create();
+ code->file->mime = "text/x-csrc";
+ elm_code_parser_standard_add(code, ELM_CODE_PARSER_STANDARD_SYNTAX);
+ file = code->file;
+
+ elm_code_file_line_append(file, "#include <stdio.h>", 18, NULL);
+ line = elm_code_file_line_get(file, 1);
+ ck_assert_int_eq(0, line->scope);
+
+ elm_code_file_line_append(file, "int main() {", 12, NULL);
+ line = elm_code_file_line_get(file, 2);
+ ck_assert_int_eq(1, line->scope);
+
+ elm_code_file_line_append(file, "}", 1, NULL);
+ elm_code_file_line_append(file, "", 0, NULL);
+ line = elm_code_file_line_get(file, 4);
+ ck_assert_int_eq(0, line->scope);
+
+ elm_code_free(code);
+ elm_shutdown();
+}
+END_TEST
+
void elm_code_test_syntax(TCase *tc)
{
tcase_add_test(tc, elm_code_syntax_lookup);
tcase_add_test(tc, elm_code_syntax_c);
+ tcase_add_test(tc, elm_code_syntax_scope_change_braces_test);
}