Skip to content

Commit

Permalink
tmp
Browse files Browse the repository at this point in the history
  • Loading branch information
simendsjo committed Mar 10, 2024
1 parent 460b027 commit 4fe0755
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions src/sequence.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,15 @@
(defun replace-all (old new haystack)
(join new (split old haystack)))

(defun starts-with (prefix string &key (test #'eql))
(eql 0 (search prefix string :test test :end2 (length prefix))))

(defun without-prefix (prefix string &key (test #'eql))
(if (starts-with prefix string :test test)
(values (subseq string (length prefix)) t)
(values string nil)))
(defun starts-with (prefix sequence &key (test #'eql))
(unless sequence
(return-from starts-with nil))
(let ((prefix-length (length prefix)))
(if (> prefix-length (length sequence))
(return-from starts-with nil))
(eql 0 (search prefix sequence :test test :end2 prefix-length))))

(defun without-prefix (prefix sequence &key (test #'eql))
(if (starts-with prefix sequence :test test)
(values (subseq sequence (length prefix)) t)
(values sequence nil)))
2 changes: 1 addition & 1 deletion tests/version.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

;; Doctests are running several tests, so these are only some additional tests
(define-test version ()
(let* ((build (version:version :version "" :pre-release nil))
(let* ((build (version:version :version "" :pre-release nil :root :sijo-version))
(fields (str:split "." (str:replace-first "0.0.0+" "" build)))
(branch (first fields))
(commit (second fields))
Expand Down

0 comments on commit 4fe0755

Please sign in to comment.