33 lines
1.1 KiB
Scheme
33 lines
1.1 KiB
Scheme
;;; Abbrev library for R7RS Scheme.
|
|
;;; SPDX-License-Identifier: LicenseRef-OWL-0.9.4
|
|
;;; SPDX-FileCopyrightText: 2025 afiw <afiw@linuxposting.xyz>
|
|
(import (abbrev)
|
|
(test))
|
|
(test "original example"
|
|
'(("lisp" . "lisp")
|
|
("lis" . "lisp")
|
|
("li" . "lisp")
|
|
("l" . "lisp")
|
|
("scala" . "scala")
|
|
("scal" . "scala")
|
|
("sca" . "scala")
|
|
("scheme" . "scheme")
|
|
("schem" . "scheme")
|
|
("sche" . "scheme")
|
|
("sch" . "scheme"))
|
|
(abbrev '("scheme" "scala" "lisp")))
|
|
(test "original example with prefix"
|
|
'(("scala" . "scala")
|
|
("scal" . "scala")
|
|
("sca" . "scala")
|
|
("scheme" . "scheme")
|
|
("schem" . "scheme")
|
|
("sche" . "scheme")
|
|
("sch" . "scheme"))
|
|
(abbrev '("scheme" "scala" "lisp") "s"))
|
|
(test-assert "empty list" (null? (abbrev '())))
|
|
(test "single-element list" '(("c" . "c")) (abbrev '("c")))
|
|
(test-assert "identical elements" (null? (abbrev '("c" "c"))))
|
|
(test-error "non-list argument" (abbrev ""))
|
|
(test-error "non-string element" (abbrev '(())))
|
|
(test-exit)
|