summaryrefslogtreecommitdiff
path: root/src/tests/elementary/elm_code_test_basic.c
diff options
context:
space:
mode:
authorAndy Williams <andy@andywilliams.me>2016-12-27 21:12:49 +0000
committerAndy Williams <andy@andywilliams.me>2016-12-27 21:12:49 +0000
commit5cf5e4bb3c62d63a61b4070a8fa27fec67414fb5 (patch)
tree378f08c726e8a672ff3b6a84471e539288810095 /src/tests/elementary/elm_code_test_basic.c
parent34abcd33c99d23d05fe19b341911167a6ee2e86b (diff)
elm_code: Fix filename/path for non-file based instances
And add tests appropriately
Diffstat (limited to '')
-rw-r--r--src/tests/elementary/elm_code_test_basic.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/tests/elementary/elm_code_test_basic.c b/src/tests/elementary/elm_code_test_basic.c
index 9805a75..5f6827b 100644
--- a/src/tests/elementary/elm_code_test_basic.c
+++ b/src/tests/elementary/elm_code_test_basic.c
@@ -4,25 +4,47 @@
4 4
5#define ELM_INTERNAL_API_ARGESFSDFEFC 5#define ELM_INTERNAL_API_ARGESFSDFEFC
6 6
7#include <stdlib.h>
8
7#include "elm_suite.h" 9#include "elm_suite.h"
8#include "Elementary.h" 10#include "Elementary.h"
9 11
10START_TEST (elm_code_create_test) 12START_TEST (elm_code_create_test)
11{ 13{
14 Elm_Code *code;
15
16 elm_init(1, NULL);
17 code = elm_code_create();
18
19 ck_assert(!!code);
20 ck_assert(elm_code_file_path_get(code->file) == NULL);
21 elm_code_free(code);
22 elm_shutdown();
23}
24END_TEST
25
26START_TEST (elm_code_open_test)
27{
12 char *path = TESTS_SRC_DIR "/testfile.txt"; 28 char *path = TESTS_SRC_DIR "/testfile.txt";
29 char realpath1[PATH_MAX], realpath2[PATH_MAX];
13 Elm_Code *code; 30 Elm_Code *code;
14 31
15 elm_init(1, NULL); 32 elm_init(1, NULL);
16 code = elm_code_create(); 33 code = elm_code_create();
17 elm_code_file_open(code, path); 34 elm_code_file_open(code, path);
18 35
36 realpath(path, realpath1);
37 realpath(elm_code_file_path_get(code->file), realpath2);
19 ck_assert(!!code); 38 ck_assert(!!code);
39 ck_assert_str_eq(realpath1, realpath2);
20 elm_code_free(code); 40 elm_code_free(code);
21 elm_shutdown(); 41 elm_shutdown();
22} 42}
23END_TEST 43END_TEST
24 44
45
25void elm_code_test_basic(TCase *tc) 46void elm_code_test_basic(TCase *tc)
26{ 47{
27 tcase_add_test(tc, elm_code_create_test); 48 tcase_add_test(tc, elm_code_create_test);
49 tcase_add_test(tc, elm_code_open_test);
28} 50}