Elm Exactly
Results / elm-url /

UrlPercentEncodeTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`Url.percentEncode` escapes characters that have a meaning in a URL, but not every punctuation character.

A space, `&` and `=` become `%20`, `%26` and `%3D`. The characters
`( ) ! * ' ~` come back unchanged.

Results

elm-0.19.1

passran in 46 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
encode1: "hello%20world"
encode2: "a%26b%3Dc"
encode3: "a(b)!*'~"

elm-0.19.2

passran in 34 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
encode1: "hello%20world"
encode2: "a%26b%3Dc"
encode3: "a(b)!*'~"

elm-0.19.3

passran in 37 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
encode1: "hello%20world"
encode2: "a%26b%3Dc"
encode3: "a(b)!*'~"

lamdera-1.5.0

passran in 43 ms
Output
encode1: "hello%20world"
encode2: "a%26b%3Dc"
encode3: "a(b)!*'~"

Discussions

Discuss this test·Search the discussions on GitHub

Discussions are on GitHub; one about this test has [t:elm-url/UrlPercentEncodeTest] in its title.

Source

The -- CHECK: lines give the expected output.

module UrlPercentEncodeTest exposing (main)
{-| `Url.percentEncode` escapes characters that have a meaning in a URL, but not every punctuation character.
A space, `&` and `=` become `%20`, `%26` and `%3D`. The characters
`( ) ! * ' ~` come back unchanged.
-}
-- CHECK: encode1: "hello%20world"
-- CHECK: encode2: "a%26b%3Dc"
-- CHECK: encode3: "a(b)!*'~"
import Html exposing (text)
import Url
main =
let
_ = Debug.log "encode1" (Url.percentEncode "hello world")
_ = Debug.log "encode2" (Url.percentEncode "a&b=c")
_ = Debug.log "encode3" (Url.percentEncode "a(b)!*'~")
in
text "done"