about summary refs log tree commit diff stats
path: root/test_prof_history.c
diff options
context:
space:
mode:
authorJames Booth <boothj5@gmail.com>2012-05-01 17:28:25 +0100
committerJames Booth <boothj5@gmail.com>2012-05-01 17:28:25 +0100
commit8202255d0f3c33efe82cdc6d8933f0328ab81aef (patch)
treec522a28ce6a39d345a9aa3f3035ecc5d1fa00d43 /test_prof_history.c
parent1730372e00a7469a05c7535c68dbfab83f8af0b4 (diff)
downloadprofani-tty-8202255d0f3c33efe82cdc6d8933f0328ab81aef.tar.gz
Added test exposing segfault in history
Diffstat (limited to 'test_prof_history.c')
-rw-r--r--test_prof_history.c18
1 files changed, 18 insertions, 0 deletions
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);
 }