Skip to content

Commit cab4bda

Browse files
committed
load-file fixed; change on load-file implementation to return last line expresion result, instead of nil
1 parent 17b9080 commit cab4bda

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

lib/core/header-load-file.lisp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,4 @@
22
(eval
33
(read-string
44
(str
5-
";; $MODULE " (quote f) "\n"
6-
"(do " (slurp f) "\nnilf)")))))
5+
";; $MODULE " (quote f) "\n(do " (slurp f) "\n)")))))

tests/step6_file.mal

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@
4040
;; Testing load-file
4141

4242
(load-file "./tests/inc.mal")
43-
;=>nil
43+
;=>(fn (a) (do (+ 3 a)))
4444
(inc1 7)
4545
;=>8
4646
(inc2 7)
@@ -110,7 +110,7 @@
110110

111111
;; Testing reading of large files
112112
(load-file "./tests/computations.mal")
113-
;=>nil
113+
;=>(fn [n] (do (if (<= n 1) n (+ (fib (- n 1)) (fib (- n 2))))))
114114
(sumdown 2)
115115
;=>3
116116
(fib 2)
@@ -149,15 +149,15 @@
149149

150150
;; Testing comments in a file
151151
(load-file "./tests/incB.mal")
152-
;=>nil
152+
;=>(fn (a) (do (+ 5 a)))
153153
(inc4 7)
154154
;=>11
155155
(inc5 7)
156156
;=>12
157157

158158
;; Testing map literal across multiple lines in a file
159159
(load-file "./tests/incC.mal")
160-
;=>nil
160+
;=>{"a" 1}
161161
mymap
162162
;=>{"a" 1}
163163

tests/stepA_mal.mal

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@
309309

310310
;; Loading sumdown from computations.mal
311311
(load-file "./tests/computations.mal")
312-
;=>nil
312+
;=>(fn [n] (do (if (<= n 1) n (+ (fib (- n 1)) (fib (- n 2))))))
313313

314314
;;
315315
;; Testing time-ms function

0 commit comments

Comments
 (0)