Elm Exactly
Results / elm-core /

StringAstralReverseTest

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
`String.reverse` keeps a character outside the Basic Multilingual Plane,
such as an emoji, whole, rather than reversing the two UTF-16 units it is
stored as.

The test checks that reversing `"a๐Ÿ˜€b"` equals reversing its `String.toList`,
that it gives `"b๐Ÿ˜€a"`, and that reversing `"x๐Ÿ˜€๐„žy"` twice returns it unchanged.

Results

elm-0.19.1

passran in 60 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
rev_matches_codepoint: True
rev_pair_kept: True
rev_twice_id: True

elm-0.19.2

passran in 53 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
rev_matches_codepoint: True
rev_pair_kept: True
rev_twice_id: True

elm-0.19.3

passran in 48 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
rev_matches_codepoint: True
rev_pair_kept: True
rev_twice_id: True

lamdera-1.5.0

passran in 44 ms
Output
rev_matches_codepoint: True
rev_pair_kept: True
rev_twice_id: True

Discussions

Discuss this testยทSearch the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module StringAstralReverseTest exposing (main)
{-| `String.reverse` keeps a character outside the Basic Multilingual Plane,
such as an emoji, whole, rather than reversing the two UTF-16 units it is
stored as.
The test checks that reversing `"a๐Ÿ˜€b"` equals reversing its `String.toList`,
that it gives `"b๐Ÿ˜€a"`, and that reversing `"x๐Ÿ˜€๐„žy"` twice returns it unchanged.
-}
-- CHECK: rev_matches_codepoint: True
-- CHECK: rev_pair_kept: True
-- CHECK: rev_twice_id: True
import Html exposing (text)
main =
let
_ =
Debug.log "rev_matches_codepoint"
(String.reverse "a๐Ÿ˜€b"
== String.fromList (List.reverse (String.toList "a๐Ÿ˜€b"))
)
_ =
Debug.log "rev_pair_kept" (String.reverse "a๐Ÿ˜€b" == "b๐Ÿ˜€a")
_ =
Debug.log "rev_twice_id" (String.reverse (String.reverse "x๐Ÿ˜€๐„žy") == "x๐Ÿ˜€๐„žy")
in
text "done"