Elm Exactly
Results / elm /

DebugLogNoDropTest

Tags:elm-unspecced

elm-0.19.1 passelm-0.19.2 passelm-0.19.3 passlamdera-1.5.0 pass
A `Debug.log` call inside an unused `let` binding still prints.

`deadLogged` is never read; its value is `String.length` applied to
`Debug.log "kept" "logged"`, and the test checks that the line
`kept: "logged"` is printed. The second unused binding, `deadPure`, contains no
`Debug` call and has no observable effect.

The relative order of the logged lines is not checked.

A Standard Definition of Elm? does not decide this test: `Debug.log l v` evaluates to `v`, and any
output it makes, its text, its order and whether it is made at all, is outside the definition
(ruling A62).

Results

elm-0.19.1

passran in 87 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.1/optimize for better performance and smaller assets.
kept: "logged"

elm-0.19.2

passran in 48 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.2/optimize for better performance and smaller assets.
kept: "logged"

elm-0.19.3

passran in 64 ms
Output
Compiled in DEV mode. Follow the advice at https://elm-lang.org/0.19.3/optimize for better performance and smaller assets.
kept: "logged"

lamdera-1.5.0

passran in 49 ms
Output
kept: "logged"

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module DebugLogNoDropTest exposing (main)
{-| A `Debug.log` call inside an unused `let` binding still prints.
`deadLogged` is never read; its value is `String.length` applied to
`Debug.log "kept" "logged"`, and the test checks that the line
`kept: "logged"` is printed. The second unused binding, `deadPure`, contains no
`Debug` call and has no observable effect.
The relative order of the logged lines is not checked.
A Standard Definition of Elm? does not decide this test: `Debug.log l v` evaluates to `v`, and any
output it makes, its text, its order and whether it is made at all, is outside the definition
(ruling A62).
-}
-- TAGS: elm-unspecced
-- CHECK: kept: "logged"
import Html exposing (text)
main : Html.Html msg
main =
let
deadLogged =
String.length (Debug.log "kept" "logged")
deadPure =
String.length "xyz"
in
text "done"