File tree 2 files changed +36
-1
lines changed
api/src/test/scala/play/twirl/api/test
2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ * Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com>
3
+ */
4
+ package play .twirl .api
5
+ package test
6
+
7
+ import org .specs2 .mutable ._
8
+
9
+ object FormatSpec extends Specification {
10
+ " HtmlFormat" should {
11
+ " escape '<', '&' and '>'" in {
12
+ HtmlFormat .escape(" foo < bar & baz >" ).body must_== " foo < bar & baz >"
13
+ }
14
+
15
+ " escape single quotes" in {
16
+ HtmlFormat .escape(" 'single quotes'" ).body must_== " 'single quotes'"
17
+ }
18
+
19
+ " escape double quotes" in {
20
+ HtmlFormat .escape(" \" double quotes\" " ).body must_== " "double quotes""
21
+ }
22
+
23
+ " not escape non-ASCII characters" in {
24
+ HtmlFormat .escape(" こんにちは" ).body must_== " こんにちは"
25
+ }
26
+ }
27
+
28
+ " JavaScriptFormat" should {
29
+ """ escape ''', '"' and '\'""" in {
30
+ JavaScriptFormat .escape(""" foo ' bar " baz \""" ).body must equalTo (""" foo \' bar \" baz \\ """ )
31
+ }
32
+ }
33
+
34
+ }
Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ lazy val api = project
11
11
.settings(crossScala : _* )
12
12
.settings(
13
13
name := " twirl-api" ,
14
- libraryDependencies += commonsLang
14
+ libraryDependencies += commonsLang,
15
+ libraryDependencies += specs2(scalaBinaryVersion.value)
15
16
)
16
17
17
18
lazy val parser = project
You can’t perform that action at this time.
0 commit comments