From e97db746cc84f9338eb60b0aa60c3b22a0aea04a Mon Sep 17 00:00:00 2001 From: Choe Hwanjin Date: Tue, 5 Jun 2018 12:29:02 +0900 Subject: =?UTF-8?q?=ED=82=A4=EB=B3=B4=EB=93=9C=20=ED=8C=8C=EC=9D=BC?= =?UTF-8?q?=EC=9D=84=20=EB=A1=9C=EB=94=A9=EC=8B=9C=20=EC=9E=AC=EA=B7=80?= =?UTF-8?q?=ED=98=B8=EC=B6=9C=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20=EC=BD=94?= =?UTF-8?q?=EB=93=9C=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 키보드 파일이 자기자신을 include한 경우에대한 테스트 코드 추가한다. 관련 api hangul_keyboard_new_from_file()도 추가하고 샘플 키보드 파일 recursive.xml을 추가한다. --- hangul/hangul.h | 1 + hangul/hangulkeyboard.c | 2 +- test/Makefile.am | 4 ++-- test/recursive.xml | 12 ++++++++++++ test/test.c | 6 ++++++ 5 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 test/recursive.xml diff --git a/hangul/hangul.h b/hangul/hangul.h index 447e1e3..61d4357 100644 --- a/hangul/hangul.h +++ b/hangul/hangul.h @@ -101,6 +101,7 @@ int hangul_fini(); /* keyboard */ HangulKeyboard* hangul_keyboard_new(void); +HangulKeyboard* hangul_keyboard_new_from_file(const char* path); void hangul_keyboard_delete(HangulKeyboard *keyboard); void hangul_keyboard_set_type(HangulKeyboard *keyboard, int type); diff --git a/hangul/hangulkeyboard.c b/hangul/hangulkeyboard.c index caaae29..c04a417 100644 --- a/hangul/hangulkeyboard.c +++ b/hangul/hangulkeyboard.c @@ -767,7 +767,7 @@ done: context->path_stack_top--; } -static HangulKeyboard* +HangulKeyboard* hangul_keyboard_new_from_file(const char* path) { HangulKeyboardLoadContext context; diff --git a/test/Makefile.am b/test/Makefile.am index 5889f49..6364f50 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -12,5 +12,5 @@ hanja_LDADD = ../hangul/libhangul.la $(LTLIBINTL) TESTS = test check_PROGRAMS = test test_SOURCES = test.c ../hangul/hangul.h -test_CFLAGS = $(CHECK_CFLAGS) -test_LDADD = $(CHECK_LIBS) $(top_builddir)/hangul/libhangul.la $(LTLIBINTL) +test_CFLAGS = $(CHECK_CFLAGS) -DTEST_SOURCE_DIR=\"$(abs_srcdir)\" +test_LDADD = $(CHECK_LIBS) ../hangul/libhangul.la $(LTLIBINTL) diff --git a/test/recursive.xml b/test/recursive.xml new file mode 100644 index 0000000..cd2ab15 --- /dev/null +++ b/test/recursive.xml @@ -0,0 +1,12 @@ + + + + Recursive + + + + + + + + diff --git a/test/test.c b/test/test.c index 3147ee5..579b5e1 100644 --- a/test/test.c +++ b/test/test.c @@ -543,6 +543,12 @@ START_TEST(test_hangul_keyboard) fail_unless(name != NULL, "error: keyboard id == NULL"); } + + HangulKeyboard* keyboard; + fail_unless( + (keyboard = hangul_keyboard_new_from_file(TEST_SOURCE_DIR "/recursive.xml")) != NULL + ); + hangul_keyboard_delete(keyboard); } END_TEST -- cgit v1.2.1