Rust library to generate static websites
1Test cases for error handling:
2
31. Duplicate locales error:
4#[route("/about", locales(en = "/en"), locales(sv = "/sv"))]
5Expected error: "locales specified multiple times"
6
72. Duplicate locale within locales:
8#[route("/about", locales(en = "/en", en = "/english"))]
9Expected error: "duplicate locale 'en' specified"
10
113. Unknown argument:
12#[route("/about", something(foo = "bar"))]
13Expected error: "unknown argument 'something'"
14
154. Prefix without base path:
16#[route(locales(en(prefix = "/en")))]
17Expected error: "Cannot use locale prefix without a base route path"
18
195. Path in wrong position:
20#[route(locales(en = "/en"), "/about")]
21Expected error: "expected named argument (e.g., locales(...)), path must be first argument"
22
23All these cases should produce compile-time errors with clear messages.
24The refactored parser enforces that the path must be the first argument (if present),
25followed by named arguments like locales(...). This is flexible enough to support
26future named arguments while maintaining clear syntax rules.