Ignore:
Timestamp:
04/25/15 19:28:15 (6 years ago)
Author:
Alexej Magura
Message:

uhhh... updates for 3.1.1

File:
1 edited

Legend:

Unmodified
Added
Removed
  • release/4/readline/trunk/tests/run.scm

    r32214 r32340  
    1 (require-extension test readline srfi-1 dummy-user)
    2 (test-begin "Readline API")
    3 (test-assert "(readline#add-history STRING) == (void)"
    4              (equal? (void) (readline#add-history "(last (readline#history-list))")))
     1(require-extension test readline srfi-1 kvlists)
     2(test-begin "Readline variables")
     3(test-assert "readline#session is a kvlist"
     4             (kvlist? readline#session))
     5(test-end)
     6(test-begin "Readline functions")
     7(readline#%add-history% "foobar")
    58
    6 (test-assert "(readline#history-list) == LIST"
    7              (list? (readline#history-list)))
     9(test-assert "history is consistent between calls"
     10             (string=? (last (readline#history-list)) "foobar"))
    811
    9 (test-assert "(last (readline#history-list)) == \"(last (readline#history-list))\""
    10              (string=? (last (readline#history-list)) (->string '(last (readline#history-list)))))
    11 
    12 (test-assert "(readline#history-position) == INTEGER"
     12(test-assert "readline#history-position returns an integer"
    1313             (integer? (readline#history-position)))
    1414
    15 (test "(set! (readline#history-position) -1) == #f"
    16       #f
    17       (set! (readline#history-position) -1))
     15(test "readline#history-position's setter works"
     16      1
     17      (and (set! (readline#history-position) 1)
     18           (readline#history-position)))
    1819
    19 (test "(readline#history-get-entry -1) == #f"
    20       #f
    21       (history-get-entry -1))
     20(readline#%add-history% "(print 1)")
    2221
    23 (test-error "(readline#add-history) == (error)"
    24             (readline#add-history))
     22(test "readline#eval-last-history-line works"
     23      (void)
     24      (readline#eval-last-history-line #t))
    2525
    26 (test-assert "(readline#history-current-entry) == (last (readline#history-list))"
    27              (string=? (readline#history-current-entry)
    28                        (last (readline#history-list))))
    29 (display (reverse (readline#history-list))) (newline)
    3026
    31 (readline#add-history "hello")
    32 (readline#add-history "blue")
    33 
    34 (test-assert "(readline#search-history-backward \"hello\") == '((match . (line . STRING) (time . (or STRING #f))) (index . INTEGER))"
    35              (let* ((result (readline#history-search-forward "hello"))
    36                    (match (alist-ref 'match result)))
    37                (string? (alist-ref 'line match))
    38                (or (string? (alist-ref 'time match)) (boolean? (alist-ref 'time match)))
    39                (integer? (alist-ref 'index result))))
    40 
    41 #|
    42 ;; needs epoch, I think.
    43 (test "(readline#add-history-time
    44 
    45 (test-assert "(readline#search-history-backward \"hello\") == '(match: (line: STRING time: STRING or #f) index: INTEGER)"
    46              (let* ((result (readline#history-search-backward "hello"))
    47                    (match (get-keyword match: result)))
    48                (string? (get-keyword line: match))
    49                (or (string? (get-keyword time: match)) (boolean? (get-keyword time: match)))
    50                (integer? (get-keyword index: result))))
    51 |#
    52 (test-end)
    53 (test-begin "Legacy API")
    54 (test "(use-legacy-bindings) == (void)"
    55       (void)
    56       (use-legacy-bindings))
    57 
    58 (define tester-inigo (make-dummy-user '("Hello, my name is Inigo Montoya." "You killed my father." "Prepare to die.")))
     27(test "readline#last-history-line is the last added line"
     28      "(print 1)"
     29      (readline#last-history-line #t #t))
    5930(test-end)
    6031(test-exit)
Note: See TracChangeset for help on using the changeset viewer.