cosmetic changes
This commit is contained in:
parent
8b88b73d74
commit
a64439232a
|
@ -6,6 +6,7 @@
|
||||||
forget to use the C++ extern "C" to get it to compile.
|
forget to use the C++ extern "C" to get it to compile.
|
||||||
*/
|
*/
|
||||||
#include <editline/readline.h>
|
#include <editline/readline.h>
|
||||||
|
#include <editline/history.h>
|
||||||
#include "picrin.h"
|
#include "picrin.h"
|
||||||
#include "picrin/pair.h"
|
#include "picrin/pair.h"
|
||||||
#include "picrin/string.h"
|
#include "picrin/string.h"
|
||||||
|
@ -130,7 +131,7 @@ pic_rl_read_history(pic_state *pic)
|
||||||
pic_get_args(pic, "z", &filename);
|
pic_get_args(pic, "z", &filename);
|
||||||
|
|
||||||
if(read_history(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();
|
return pic_undef_value();
|
||||||
}
|
}
|
||||||
|
@ -143,7 +144,7 @@ pic_rl_write_history(pic_state *pic)
|
||||||
pic_get_args(pic, "z", &filename);
|
pic_get_args(pic, "z", &filename);
|
||||||
|
|
||||||
if(write_history(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();
|
return pic_undef_value();
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,31 +20,30 @@
|
||||||
;; (readline "prompt")
|
;; (readline "prompt")
|
||||||
|
|
||||||
(define testfile "./picrin_readline_test_file")
|
(define testfile "./picrin_readline_test_file")
|
||||||
|
|
||||||
(test-begin)
|
(test-begin)
|
||||||
|
|
||||||
(test 0 (history-length))
|
(test 0 (history-length))
|
||||||
(add-history "0")
|
(add-history "1")
|
||||||
(test 1 (history-length))
|
(test 1 (history-length))
|
||||||
(let loop ((n 1))
|
(let loop ((n 2))
|
||||||
(if (> 10 n)
|
(if (>= 10 n)
|
||||||
(begin
|
(begin
|
||||||
(add-history (number->string n))
|
(add-history (number->string n))
|
||||||
(loop (+ n 1)))))
|
(loop (+ n 1)))))
|
||||||
(test 10 (history-length))
|
(test 10 (history-length))
|
||||||
(stifle-history 7)
|
(stifle-history 7)
|
||||||
(test 7 (history-length))
|
(test 10 (history-length))
|
||||||
(add-history "10")
|
(add-history "11")
|
||||||
(test 7 (history-length))
|
(test 7 (history-length))
|
||||||
(test #t (history-stifled?))
|
(test #t (history-stifled?))
|
||||||
(unstifle-history)
|
(unstifle-history)
|
||||||
(test #f (history-stifled?))
|
(test #f (history-stifled?))
|
||||||
(test 7 (history-length))
|
(test 7 (history-length))
|
||||||
(add-history "11")
|
(add-history "12")
|
||||||
(test 8 (history-length))
|
(test 8 (history-length))
|
||||||
(test "10" (history-get 11))
|
(test "11" (history-get 11))
|
||||||
(remove-history 1)
|
(remove-history 1)
|
||||||
(test "10" (history-get 11))
|
(test "11" (history-get 11))
|
||||||
(test 7 (history-length))
|
(test 7 (history-length))
|
||||||
(write-history testfile)
|
(write-history testfile)
|
||||||
(test 7 (history-length))
|
(test 7 (history-length))
|
||||||
|
|
Loading…
Reference in New Issue