This commit is contained in:
2022-05-23 00:29:01 +00:00
parent 69f37d33f9
commit c52e74c235
3 changed files with 26 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ import utest.Test;
import utest.Assert;
import kiss.Prelude;
import kiss.List;
import kiss.Stream;
import haxe.ds.Option;
using StringTools;
@@ -341,6 +342,10 @@ class BasicTestCase extends Test {
function testIntersect() {
_testIntersect();
}
function testWhileLet() {
_testWhileLet();
}
}
class BasicObject {

View File

@@ -628,4 +628,12 @@
(assert (contains intersection3d "cy1"))
(assert (contains intersection3d "cy3"))
)
(Assert.pass))
(Assert.pass))
(function _testWhileLet []
(let [&mut idx 0
lines ["a" "b" "c"]
stream (Stream.fromString "a\nb\nc")]
(whileLet [(Some line) (stream.takeLine)]
(Assert.equals (nth lines idx) line)
(+= idx 1))))