diff --git a/contrib/10.readline/src/readline.c b/contrib/10.readline/src/readline.c index f9de7060..fb043dd7 100644 --- a/contrib/10.readline/src/readline.c +++ b/contrib/10.readline/src/readline.c @@ -6,6 +6,7 @@ forget to use the C++ extern "C" to get it to compile. */ #include +#include #include "picrin.h" #include "picrin/pair.h" #include "picrin/string.h" @@ -130,7 +131,7 @@ pic_rl_read_history(pic_state *pic) pic_get_args(pic, "z", &filename); if(read_history(filename)) - pic_errorf(pic, "cannot read history file :%s", filename); + pic_errorf(pic, "cannot read history file : %s", filename); return pic_undef_value(); } @@ -143,7 +144,7 @@ pic_rl_write_history(pic_state *pic) pic_get_args(pic, "z", &filename); if(write_history(filename)) - pic_errorf(pic, "cannot write history file:%s", filename); + pic_errorf(pic, "cannot write history file: %s", filename); return pic_undef_value(); } diff --git a/contrib/10.readline/t/test.scm b/contrib/10.readline/t/test.scm index af695621..fa5c8a08 100644 --- a/contrib/10.readline/t/test.scm +++ b/contrib/10.readline/t/test.scm @@ -20,31 +20,30 @@ ;; (readline "prompt") (define testfile "./picrin_readline_test_file") - (test-begin) (test 0 (history-length)) -(add-history "0") +(add-history "1") (test 1 (history-length)) -(let loop ((n 1)) - (if (> 10 n) +(let loop ((n 2)) + (if (>= 10 n) (begin (add-history (number->string n)) (loop (+ n 1))))) (test 10 (history-length)) (stifle-history 7) -(test 7 (history-length)) -(add-history "10") +(test 10 (history-length)) +(add-history "11") (test 7 (history-length)) (test #t (history-stifled?)) (unstifle-history) (test #f (history-stifled?)) (test 7 (history-length)) -(add-history "11") +(add-history "12") (test 8 (history-length)) -(test "10" (history-get 11)) +(test "11" (history-get 11)) (remove-history 1) -(test "10" (history-get 11)) +(test "11" (history-get 11)) (test 7 (history-length)) (write-history testfile) (test 7 (history-length))