published to our maven
This commit is contained in:
1 parent
185aa4e0cf
commit
8c6a1979ed
39 files changed
+89
-104
No files matched your search
@@ -0,0 +1,34 @@
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.runBlocking
|
||||
import kotlinx.coroutines.withContext
|
||||
import kotlinx.datetime.Clock
|
||||
import net.sergeych.lyng.Context
|
||||
import java.nio.file.Files
|
||||
import java.nio.file.Paths
|
||||
import kotlin.io.path.extension
|
||||
import kotlin.test.Test
|
||||
|
||||
suspend fun executeSampleTests(fileName: String) {
|
||||
val sample = withContext(Dispatchers.IO) {
|
||||
Files.readString(Paths.get(fileName))
|
||||
}
|
||||
runBlocking {
|
||||
val c = Context()
|
||||
val start = Clock.System.now()
|
||||
c.eval(sample)
|
||||
val time = Clock.System.now() - start
|
||||
println("$time: $fileName")
|
||||
// delay(100)
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
class SamplesTest {
|
||||
|
||||
@Test
|
||||
fun testSamples() = runBlocking {
|
||||
for (s in Files.list(Paths.get("../docs/samples"))) {
|
||||
if (s.extension == "lyng") executeSampleTests(s.toString())
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user