git.fiddlerwoaroof.com
Browse code

fix splitting

fiddlerwoaroof authored on 03/06/2018 00:45:24
Showing 2 changed files
... ...
@@ -102,7 +102,8 @@
102 102
              (setf start-pos (1+ end-pos))
103 103
            while (< (length parts) (1- count))
104 104
            finally
105
-             (cond ((and end-pos count)
105
+             (cond ((or (and end-pos count)
106
+                        (< start-pos (length string)))
106 107
                     (vector-push (subseq string start-pos)
107 108
                                  parts))
108 109
                    ((not end-pos)
... ...
@@ -76,4 +76,9 @@
76 76
     (st:should be vos-equal
77 77
                #("")
78 78
                (%split-on-char #\/ "")))
79
+
80
+  (st:deftest char-split-no-sep-returns-vec-with-contents ()
81
+    (st:should be vos-equal
82
+               #("Bacon")
83
+               (%split-on-char #\. "Bacon")))
79 84
   )