Elm Exactly
Results / elm /

ModuleHeaderMissingImportedTest

Tags:elm-spec

Checks, in A Standard Definition of Elm?:restriction modules-header

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 module that imports a file with no `module` line is rejected.

`ModuleHeaderMissingHelper.elm` holds a value but no header.

A Standard Definition of Elm?, restriction modules-header: every module begins with a header,
`module M exposing (...)` or `port module M exposing (...)`; a text that does not begin with a
header is not a module of Standard Elm. <https://elm-test-suite.netlify.app/standard/restrictions/modules-header>

Results

elm-0.19.1

pass
Output
Compiling ...-- MODULE NAME MISSING ----------------------- src/ModuleHeaderMissingHelper.elm

I need the module name to be declared at the top of this file, like this:

    module ModuleHeaderMissingHelper exposing (..)

Try adding that as the first line of your file!

Note: It is best to replace (..) with an explicit list of types and functions
you want to expose. When you know a value is only used within this module, you
can refactor without worrying about uses elsewhere. Limiting exposed values can
also speed up compilation because I can skip a bunch of work if I see that the
exposed API has not changed.

Detected problems in 1 module.

elm-0.19.2

pass
Output
Compiling ...-- MODULE NAME MISSING ----------------------- src/ModuleHeaderMissingHelper.elm

I need the module name to be declared at the top of this file, like this:

    module ModuleHeaderMissingHelper exposing (..)

Try adding that as the first line of your file!

Note: It is best to replace (..) with an explicit list of types and functions
you want to expose. When you know a value is only used within this module, you
can refactor without worrying about uses elsewhere. Limiting exposed values can
also speed up compilation because I can skip a bunch of work if I see that the
exposed API has not changed.

Detected problems in 1 module.

elm-0.19.3

pass
Output
Compiling ...-- MODULE NAME MISSING ----------------------- src/ModuleHeaderMissingHelper.elm

I need the module name to be declared at the top of this file, like this:

    module ModuleHeaderMissingHelper exposing (..)

Try adding that as the first line of your file!

Note: It is best to replace (..) with an explicit list of types and functions
you want to expose. When you know a value is only used within this module, you
can refactor without worrying about uses elsewhere. Limiting exposed values can
also speed up compilation because I can skip a bunch of work if I see that the
exposed API has not changed.

Detected problems in 1 module.

lamdera-1.5.0

pass
Output
Detected problems in 1 module.
-- MODULE NAME MISSING ----------------------- src/ModuleHeaderMissingHelper.elm

I need the module name to be declared at the top of this file, like this:

    module ModuleHeaderMissingHelper exposing (..)

Try adding that as the first line of your file!

Note: It is best to replace (..) with an explicit list of types and functions
you want to expose. When you know a value is only used within this module, you
can refactor without worrying about uses elsewhere. Limiting exposed values can
also speed up compilation because I can skip a bunch of work if I see that the
exposed API has not changed.

Discussions

Discuss this test·Search the discussions on GitHub

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

Source

The -- CHECK: lines give the expected output.

module ModuleHeaderMissingImportedTest exposing (main)
{-| A module that imports a file with no `module` line is rejected.
`ModuleHeaderMissingHelper.elm` holds a value but no header.
A Standard Definition of Elm?, restriction modules-header: every module begins with a header,
`module M exposing (...)` or `port module M exposing (...)`; a text that does not begin with a
header is not a module of Standard Elm. <https://elm-test-suite.netlify.app/standard/restrictions/modules-header>
-}
-- TAGS: elm-spec, modules-header
-- COMPILE-ERROR: an imported module has no header
-- CHECK: {{-- [A-Z ]+ -}}
import Html
import ModuleHeaderMissingHelper
main =
let
_ =
Debug.log "v" ModuleHeaderMissingHelper.v
in
Html.text "done"

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 the translator's front end refuses it: it breaks a restriction on characters, tokens and layout, which Lean does not model. See the Lean mechanisation for which tests are in Lean, and why.