From 8202255d0f3c33efe82cdc6d8933f0328ab81aef Mon Sep 17 00:00:00 2001 From: James Booth Date: Tue, 1 May 2012 17:28:25 +0100 Subject: Added test exposing segfault in history --- test_prof_history.c | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test_prof_history.c') diff --git a/test_prof_history.c b/test_prof_history.c index 69028609..80332a55 100644 --- a/test_prof_history.c +++ b/test_prof_history.c @@ -197,6 +197,23 @@ void edit_previous_and_append(void) assert_string_equals("EDITED", item4); } +void start_session_add_new_submit_previous(void) +{ + PHistory history = p_history_new(10); + p_history_append(history, "hello"); + + char *item1 = p_history_previous(history, NULL); + assert_string_equals("hello", item1); + + char *item2 = p_history_next(history, item1); + assert_is_null(item2); + + char *item3 = p_history_previous(history, "new text"); + assert_string_equals("hello", item3); + + p_history_append(history, item3); +} + void register_prof_history_tests(void) { TEST_MODULE("prof_history tests"); @@ -212,4 +229,5 @@ void register_prof_history_tests(void) TEST(navigate_then_append_new); TEST(edit_item_mid_history); TEST(edit_previous_and_append); + TEST(start_session_add_new_submit_previous); } -- cgit 1.4.1-2-gfad0