Elm Exactly
Results / elm-core /

StringPadTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
Checks that `String.padLeft` and `String.padRight` pad a string to the requested length with the given character.

Results

elm-0.19.1

passran in 68 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
padLeft1: "  hi"
padRight1: "hi  "
padLeft_char: "00042"

elm-0.19.2

passran in 47 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
padLeft1: "  hi"
padRight1: "hi  "
padLeft_char: "00042"

elm-0.19.3

passran in 84 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
padLeft1: "  hi"
padRight1: "hi  "
padLeft_char: "00042"

lamdera-1.5.0

passran in 34 ms
Output
padLeft1: "  hi"
padRight1: "hi  "
padLeft_char: "00042"

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module StringPadTest exposing (main)
{-| Checks that `String.padLeft` and `String.padRight` pad a string to the requested length with the given character.
-}
-- CHECK: padLeft1: " hi"
-- CHECK: padRight1: "hi "
-- CHECK: padLeft_char: "00042"
import Html exposing (text)
main =
let
_ = Debug.log "padLeft1" (String.padLeft 4 ' ' "hi")
_ = Debug.log "padRight1" (String.padRight 4 ' ' "hi")
_ = Debug.log "padLeft_char" (String.padLeft 5 '0' "42")
in
text "done"