Skip to content

Commit

Permalink
[fsbolero#10] Add rejection test: {*rest} in non-final position
Browse files Browse the repository at this point in the history
  • Loading branch information
Tarmil committed Jan 22, 2019
1 parent a09ae5d commit 064b9b5
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/Unit/Tests/Routing.fs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ open OpenQA.Selenium
/// Blazor router integration.
[<Category "Routing">]
module Routing =
open Bolero

let elt = NodeFixture()

Expand Down Expand Up @@ -44,3 +45,17 @@ module Routing =
with :? WebDriverTimeoutException -> None
res |> Option.iter (fun res -> Assert.AreEqual(resCls, res.Text))
Assert.AreEqual(WebFixture.Url + url, WebFixture.Driver.Url)

let failingRouter<'T>() =
TestCaseData(fun () -> Router.infer<'T, _, _> id id |> ignore)
.SetArgDisplayNames(typeof<'T>.Name)

type RestNotLast = | [<EndPoint "/foo/{*x}/bar">] RestNotLast of x: string

let failingRouters = [
failingRouter<RestNotLast>()
]

[<Test; TestCaseSource "failingRouters"; NonParallelizable>]
let ``Invalid routers``(makeAndIgnoreRouter: unit -> unit) =
Assert.Throws(fun () -> makeAndIgnoreRouter()) |> ignore

0 comments on commit 064b9b5

Please sign in to comment.