diff --git a/Readme.org b/Readme.org index 449e6e1..dcd7e30 100644 --- a/Readme.org +++ b/Readme.org @@ -481,8 +481,6 @@ Note: this section will not show the status of each item unless you are viewing Note: this section only tracks the state of incomplete TODO items. Having everything on here would be cluttered. ** TODO Pre-alpha tasks -- paths function -- add-path function - Shell module - Only loadable via POSIX config var - Overload Load function to hook into this lib diff --git a/snippets/userlib-tests.rls b/snippets/userlib-tests.rls index d342081..cb93c5d 100644 --- a/snippets/userlib-tests.rls +++ b/snippets/userlib-tests.rls @@ -67,6 +67,21 @@ (quote (not (contains? (1 2 3) 4)))) + ('get-paths properly splits path into segments' + (quote + (let ((PATH "/seg1:/seg2") + (split-path (get-paths))) + (and (eq? (len split-path) 2) + (contains? split-path "/seg1") + (contains? split-path "/seg2"))))) + + ('add-path properly adds a new path segment to PATH' + (quote + (let ((PATH "/seg1:/seg2") + (new-path "/seg3")) + (add-path new-path) + (contains? (get-paths) new-path)))) + ;; add more test cases here )) diff --git a/snippets/userlib.rls b/snippets/userlib.rls index ae70164..3a16a7b 100644 --- a/snippets/userlib.rls +++ b/snippets/userlib.rls @@ -100,3 +100,12 @@ Returns true if the list contains the element.' (set (q found) true) (set (q list-iter) (pop remaining))))) found)) + +(def get-paths +'returns each individual directory in PATH' +() (split PATH ':')) + +(def add-path +'adds a directory to PATH' +(path) (set (q PATH) + (concat PATH ':' path))) \ No newline at end of file