correct next* return value (fixes #187)

candidate-v2.0
Matthew Butterick 6 years ago
parent 4a55c98a0c
commit 8c27ed5406

@ -231,7 +231,7 @@
[pagetree-nodes (pagetree->list (get-pagetree pt-or-path))])
(case side
[(right) (match (memq pagenode pagetree-nodes)
[(list _ rest ...) rest]
[(list _ rest ..1) rest]
[_ #false])]
[else (match (loop 'right pagenode (reverse pagetree-nodes))
[(? pair? result) (reverse result)]
@ -254,11 +254,15 @@
(check-equal? (previous* 'three test-pagetree) '(foo bar one two))
(check-false (previous* 'foo test-pagetree)))
(define+provide/contract (next* pnish [pt-or-path (current-pagetree)])
(((or/c #f pagenodeish?)) ((or/c pagetree? pathish?)) . ->* . (or/c #f pagenodes?))
(adjacents 'right pnish pt-or-path))
(module-test-external
(define test-pagetree `(pagetree-main foo bar (one (two three))))
(check-equal? (next* 'foo test-pagetree) '(bar one two three))
(check-equal? (next* 'one test-pagetree) '(two three))
(check-false (next* 'three test-pagetree)))
(define+provide/contract (previous pnish [pt-or-path (current-pagetree)])
(((or/c #f pagenodeish?)) ((or/c pagetree? pathish?)) . ->* . (or/c #f pagenode?))

@ -1 +1 @@
1543680907
1544914993

Loading…
Cancel
Save