Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[#324] Fixed bug in Router.queryString when handling empty strings fr…
…om QueryStringBindable
- Loading branch information
Showing
2 changed files
with
25 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
framework/src/play/src/test/scala/play/core/router/RouterSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package play.core.router | ||
|
||
import org.specs2.mutable.Specification | ||
import play.core.Router | ||
|
||
object RouterSpec extends Specification { | ||
"Router queryString builder" should { | ||
"build a query string" in { | ||
Router.queryString(List(Some("a"), Some("b"))) must_== "?a&b" | ||
} | ||
"ignore none values" in { | ||
Router.queryString(List(Some("a"), None, Some("b"))) must_== "?a&b" | ||
Router.queryString(List(None, Some("a"), None)) must_== "?a" | ||
} | ||
"ignore empty values" in { | ||
Router.queryString(List(Some("a"), Some(""), Some("b"))) must_== "?a&b" | ||
Router.queryString(List(Some(""), Some("a"), Some(""))) must_== "?a" | ||
} | ||
"produce nothing if no values" in { | ||
Router.queryString(List(None, Some(""))) must_== "" | ||
Router.queryString(List()) must_== "" | ||
} | ||
} | ||
} |