fix asciilib tests

This commit is contained in:
2021-11-29 16:35:44 -07:00
parent 05f72a20c1
commit 9db8c5395d
2 changed files with 5 additions and 5 deletions

View File

@@ -16,7 +16,7 @@
(method _index [x y]
(+ x (* y width)))
(defmacro withIndex [idxName xName yName &body body]
(defMacro withIndex [idxName xName yName &body body]
`(let [,idxName (_index ,xName ,yName)]
,@body))

View File

@@ -59,16 +59,15 @@
((Some colorLine)
(let [[symbol _r _g _b] (colorLine.split " ")]
(dictSet colors symbol (object r (Std.parseInt _r) g (Std.parseInt _g) b (Std.parseInt _b)))))
(None (throw "Expected INFO CODES in Surface"))))
(otherwise (throw "Expected INFO CODES in Surface"))))
(loop
(case (stream.takeLine)
((Some "SIZE") (break))
((Some infoLine)
(let [infoTokens (infoLine.split " ")]
(dictSet infoCodes (infoTokens.shift) (infoTokens.join " "))))
(None (throw "Expected SIZE in Surface"))))
(otherwise (throw "Expected SIZE in Surface"))))
(case (stream.takeLine)
(None (throw "expected [width] [height] in Surface"))
((Some sizeLine)
(let [[width height] (.map (sizeLine.split " ") Std.parseInt)
surface (new Surface width height)]
@@ -95,4 +94,5 @@
(doFor x (range width)
(surface.specialInfo.setCell x y (dictGet infoCodes (stream.expect "a special info code" ->{(stream.takeChars 1)}))))
(stream.dropString "\n"))
surface)))))
surface))
(otherwise (throw "expected [width] [height] in Surface")))))