Elm Exactly
Results / elm /

ParseErrorStringEscapeTooFewDigitsTest

Tags:elm19-compile-errorelm-spec

Checks, in A Standard Definition of Elm?:restriction core-escape-unicodefigure core-escapes

Not translated into Lean for the mechanisation of the book: see why.

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
A Unicode escape in a string with only two hex digits, `"\u{41}"`, is rejected with a BAD UNICODE ESCAPE syntax error.

Elm requires four to six hex digits between the braces of a `\u{...}` escape.

Results

elm-0.19.1

pass
Output
Compiling ...-- BAD UNICODE ESCAPE ----------- src/ParseErrorStringEscapeTooFewDigitsTest.elm

Every code point needs at least four digits:

14|     "\u{41}"
         ^^^^^^
Try \u{0041} instead?

Detected problems in 1 module.

elm-0.19.2

pass
Output
Compiling ...-- BAD UNICODE ESCAPE ----------- src/ParseErrorStringEscapeTooFewDigitsTest.elm

Every code point needs at least four digits:

14|     "\u{41}"
         ^^^^^^
Try \u{0041} instead?

Detected problems in 1 module.

elm-0.19.3

pass
Output
Compiling ...-- BAD UNICODE ESCAPE ----------- src/ParseErrorStringEscapeTooFewDigitsTest.elm

Every code point needs at least four digits:

14|     "\u{41}"
         ^^^^^^
Try \u{0041} instead?

Detected problems in 1 module.

lamdera-1.5.0

pass
Output
Detected problems in 1 module.
-- BAD UNICODE ESCAPE ----------- src/ParseErrorStringEscapeTooFewDigitsTest.elm

Every code point needs at least four digits:

14|     "\u{41}"
         ^^^^^^
Try \u{0041} instead?

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module ParseErrorStringEscapeTooFewDigitsTest exposing (..)
{-| A Unicode escape in a string with only two hex digits, `"\u{41}"`, is rejected with a BAD UNICODE ESCAPE syntax error.
Elm requires four to six hex digits between the braces of a `\u{...}` escape.
-}
-- TAGS: elm19-compile-error
-- TAGS: elm-spec, core-escape-unicode, fig:core-escapes
-- COMPILE-ERROR: BAD UNICODE ESCAPE
-- CHECK: -- BAD UNICODE ESCAPE -
x =
"\u{41}"

Lean translation

No reduced program for Lean's evaluator: the test expects a compile error, so it has no meaning to evaluate. Static semantics: expected to be rejected, and eco's parser rejects it too. See the Lean mechanisation for which tests are in Lean, and why.