Update.
This commit is contained in:
Vendored
+12
@@ -0,0 +1,12 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "html" for Html
|
||||
|
||||
var encoded = Html.encodeParams({"name": "John Doe", "age": 30})
|
||||
System.print(encoded.contains("name=John+Doe")) // expect: true
|
||||
System.print(encoded.contains("age=30")) // expect: true
|
||||
System.print(encoded.contains("&")) // expect: true
|
||||
|
||||
var decoded = Html.decodeParams("name=John+Doe&age=30")
|
||||
System.print(decoded["name"]) // expect: John Doe
|
||||
System.print(decoded["age"]) // expect: 30
|
||||
Vendored
+13
@@ -0,0 +1,13 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "html" for Html
|
||||
|
||||
System.print(Html.quote("<script>")) // expect: <script>
|
||||
System.print(Html.quote("a & b")) // expect: a & b
|
||||
System.print(Html.quote("\"quoted\"")) // expect: "quoted"
|
||||
System.print(Html.quote("it's")) // expect: it's
|
||||
System.print(Html.quote("normal text")) // expect: normal text
|
||||
|
||||
System.print(Html.unquote("<script>")) // expect: <script>
|
||||
System.print(Html.unquote("a & b")) // expect: a & b
|
||||
System.print(Html.unquote(""quoted"")) // expect: "quoted"
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "html" for Html
|
||||
|
||||
System.print(Html.slugify("Hello World")) // expect: hello-world
|
||||
System.print(Html.slugify("This is a TEST")) // expect: this-is-a-test
|
||||
System.print(Html.slugify("foo---bar")) // expect: foo-bar
|
||||
System.print(Html.slugify(" spaces ")) // expect: spaces
|
||||
System.print(Html.slugify("test123")) // expect: test123
|
||||
System.print(Html.slugify("UPPERCASE")) // expect: uppercase
|
||||
Vendored
+14
@@ -0,0 +1,14 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "html" for Html
|
||||
|
||||
System.print(Html.urldecode("hello+world")) // expect: hello world
|
||||
|
||||
var encoded1 = "foo" + "\%3D" + "bar"
|
||||
System.print(Html.urldecode(encoded1)) // expect: foo=bar
|
||||
|
||||
var encoded2 = "a" + "\%26" + "b"
|
||||
System.print(Html.urldecode(encoded2)) // expect: a&b
|
||||
|
||||
System.print(Html.urldecode("test")) // expect: test
|
||||
System.print(Html.urldecode("")) // expect:
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
// retoor <retoor@molodetz.nl>
|
||||
|
||||
import "html" for Html
|
||||
|
||||
System.print(Html.urlencode("hello world")) // expect: hello+world
|
||||
System.print(Html.urlencode("foo=bar")) // expect: foo%3Dbar
|
||||
System.print(Html.urlencode("a&b")) // expect: a%26b
|
||||
System.print(Html.urlencode("test")) // expect: test
|
||||
System.print(Html.urlencode("")) // expect:
|
||||
Reference in New Issue
Block a user