Coverage Summary for Class: RoutingKt (kweb.routing)

Class Method, % Branch, % Line, % Instruction, %
RoutingKt 0% (0/1) 0% (0/1) 0% (0/13)
RoutingKt$testSampleForRouting$1 0% (0/1) 0% (0/1) 0% (0/6)
RoutingKt$testSampleForRouting$1$1 0% (0/1) 0% (0/1) 0% (0/4)
RoutingKt$testSampleForRouting$1$1$1 0% (0/1) 0% (0/2) 0% (0/10)
RoutingKt$testSampleForRouting$1$1$1$1 0% (0/1) 0% (0/2) 0% (0/17)
RoutingKt$testSampleForRouting$1$1$1$1$1 0% (0/1) 0% (0/1) 0% (0/2)
RoutingKt$testSampleForRouting$1$1$1$2 0% (0/1) 0% (0/2) 0% (0/17)
RoutingKt$testSampleForRouting$1$1$1$2$1 0% (0/1) 0% (0/1) 0% (0/2)
Total 0% (0/8) 0% (0/11) 0% (0/71)


 package kweb.routing
 
 import io.ktor.server.routing.*
 import kweb.ElementCreator
 import kweb.Kweb
 import kweb.h1
 import kweb.route
 import kweb.state.KVar
 
 typealias PathTemplate = List<RoutingPathSegment>
 typealias PathReceiver = ElementCreator<*>.(params: Map<String, KVar<String>>) -> Unit
 typealias NotFoundReceiver = (ElementCreator<*>).(path: String) -> Unit
 
 private fun testSampleForRouting() {
     Kweb(port = 16097, buildPage = {
         doc.body {
             route {
                 path("/users/{userId}") { params ->
                     val userId = params.getValue("userId")
                     h1().text(userId.map { "User id: $it" })
                 }
                 path("/lists/{listId}") { params ->
                     val listId = params.getValue("listId")
                     h1().text(listId.map { "List id: $it" })
                 }
             }
         }
     })
 }