mirror of
https://github.com/InsanusMokrassar/krontab.git
synced 2026-10-28 15:13:17 +00:00
1 parent
58f30aef15
commit
8ac6cd3e62
2 files changed
+15
-7
No files matched your search
@@ -1,14 +1,22 @@
|
||||
package dev.inmo.krontab.utils
|
||||
|
||||
import com.soywiz.klock.DateTime
|
||||
import com.soywiz.klock.days
|
||||
import dev.inmo.krontab.buildSchedule
|
||||
import kotlin.test.Test
|
||||
import kotlin.test.assertNotNull
|
||||
import kotlin.test.*
|
||||
|
||||
class InfinityLoopCheckTest {
|
||||
@Test
|
||||
fun absenceOfInfinityLoopCheckTest() {
|
||||
runTest {
|
||||
assertNotNull(buildSchedule("0 0 0 1 *").next())
|
||||
val now = DateTime.now().startOfYear.startOfDay
|
||||
for (i in 0 until now.year.days) {
|
||||
val scheduleDateTime = (now + i.days)
|
||||
runTest {
|
||||
assertEquals(
|
||||
scheduleDateTime,
|
||||
buildSchedule("0 0 0 ${scheduleDateTime.dayOfMonth - 1} ${scheduleDateTime.month0}").next(now)
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user