0.8.4: stadlib in Lyng! added universal Iterable functions
This commit is contained in:
1 parent
f9198fe583
commit
3948283481
15 files changed
+338
-15
No files matched your search
@@ -5,6 +5,7 @@ import kotlinx.coroutines.flow.flowOn
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.test.runTest
|
||||
import net.sergeych.lyng.Scope
|
||||
import net.sergeych.lyng.Script
|
||||
import net.sergeych.lyng.obj.ObjVoid
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Files.readAllLines
|
||||
@@ -163,9 +164,10 @@ fun parseDocTests(fileName: String, bookMode: Boolean = false): Flow<DocTest> =
|
||||
}
|
||||
.flowOn(Dispatchers.IO)
|
||||
|
||||
suspend fun DocTest.test(scope: Scope = Scope()) {
|
||||
suspend fun DocTest.test(_scope: Scope? = null) {
|
||||
val collectedOutput = StringBuilder()
|
||||
val currentTest = this
|
||||
val scope = _scope ?: Script.newScope()
|
||||
scope.apply {
|
||||
addFn("println") {
|
||||
if( bookMode ) {
|
||||
@@ -304,4 +306,9 @@ class BookTest {
|
||||
runDocTests("../docs/parallelism.md")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testRingBuffer() = runBlocking {
|
||||
runDocTests("../docs/RingBuffer.md")
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user