diff --git a/tests/.gitignore b/tests/.gitignore new file mode 100644 index 00000000..cbb16464 --- /dev/null +++ b/tests/.gitignore @@ -0,0 +1 @@ +.elm diff --git a/tests/elm.json b/tests/elm.json index 3c64414c..dc635d4e 100644 --- a/tests/elm.json +++ b/tests/elm.json @@ -1,26 +1,18 @@ { - "type": "application", - "source-directories": [], - "elm-version": "0.19.1", + "type": "package", + "name": "elm/core-tests", + "summary": "Elm's standard libraries", + "license": "BSD-3-Clause", + "version": "1.0.5", + "elm-version": "0.19.0 <= v < 0.20.0", + "exposed-modules": [ + "EmptyPlaceholderModule" + ], "dependencies": { - "direct": { - "elm/browser": "1.0.1", - "elm/core": "1.0.2", - "elm/html": "1.0.0" - }, - "indirect": { - "elm/json": "1.1.2", - "elm/time": "1.0.0", - "elm/url": "1.0.0", - "elm/virtual-dom": "1.0.2" - } + "elm/core": "1.0.0 <= v < 2.0.0" }, "test-dependencies": { - "direct": { - "elm-explorations/test": "1.2.1" - }, - "indirect": { - "elm/random": "1.0.0" - } + "elm/json": "1.1.3 <= v < 2.0.0", + "elm-explorations/test": "1.2.2 <= v < 2.0.0" } } diff --git a/tests/run-tests.sh b/tests/run-tests.sh index b00aaa6e..b1c7f5cd 100755 --- a/tests/run-tests.sh +++ b/tests/run-tests.sh @@ -3,68 +3,42 @@ set -o errexit; set -o nounset; -#let the caller supply an ELM_TEST binary if desired +# Let the caller supply an ELM_TEST binary if desired. if [ -z "${ELM_TEST:-}" ]; then ELM_TEST=elm-test; fi -# since elm/core is treated specially by the compiler (it's always +# Since elm/core is treated specially by the compiler (it's always # inserted as a dependency even when not declared explicitly), we use # a bit of a hack to make the tests run against the local source code # rather than the elm/core source fetched from package.elm-lang.org. -# create a local directory where the compiler will look for the +# Create a local directory where the compiler will look for the # elm/core source code: DIR="$(dirname $0)"; cd "$DIR"; -export ELM_HOME="$(pwd)/.elm"; - +export ELM_HOME="$PWD/.elm"; rm -rf "$ELM_HOME" && mkdir -p "$ELM_HOME"; - -# elm-test also puts some things in elm-stuff, start with a clean -# slate there as well - rm -rf elm-stuff; -# now make an initial run of the tests to populate .elm and elm-stuff; -# this will test against elm/core from package.elm-lang.org, so we -# don't really care what the results are; we just need to force all -# the *other* dependencies to be fetched and set up. - -echo "seeding framework for test dependencies ..."; - -# '|| true' lets us ignore failures here and keep the script running. -# useful when developing a fix for a bug that exists in the version of -# elm/core hosted on package.elm-lang.org -"${ELM_TEST}" tests/Main.elm --fuzz=1 > /dev/null || true; - -# clear out the copy of elm-core fetched by the above and replace it -# with the local source code we want to actually test - -VERSION_DIR="$(ls ${ELM_HOME}/0.19.1/packages/elm/core/)" -CORE_PACKAGE_DIR="${ELM_HOME}/0.19.1/packages/elm/core/$VERSION_DIR" +# Create a link to the git package +VERSION=$(node -e "console.log(require('../elm.json').version)") +CORE_LINK="${ELM_HOME}/0.19.1/packages/elm/core/${VERSION}" CORE_GIT_DIR="$(dirname $PWD)" - echo; -echo "Linking $CORE_PACKAGE_DIR to $CORE_GIT_DIR" +echo "Linking $CORE_LINK to $CORE_GIT_DIR" echo; - -rm -rf "$CORE_PACKAGE_DIR" -ln -sv "$CORE_GIT_DIR" "$CORE_PACKAGE_DIR" +mkdir -p "$(dirname $CORE_LINK)" +ln -sv "${CORE_GIT_DIR}" "${CORE_LINK}" rm -vf "${CORE_GIT_DIR}"/*.dat "${CORE_GIT_DIR}"/doc*.json -# we also need to clear out elm-test's elm-stuff dir, since otherwise -# the compiler complains that its .dat files are out of sync - -rm -rf elm-stuff; - -# now we can run the tests against the symlinked source code for real +# Now we can run the tests against the symlinked source code for real. echo; echo "running tests ..."; echo; -"${ELM_TEST}" tests/Main.elm "$@"; +"${ELM_TEST}" "$@"; diff --git a/tests/src/empty b/tests/src/empty new file mode 100644 index 00000000..e69de29b diff --git a/tests/tests/Main.elm b/tests/tests/Main.elm deleted file mode 100644 index 51bef482..00000000 --- a/tests/tests/Main.elm +++ /dev/null @@ -1,40 +0,0 @@ -module Main exposing (..) - -import Basics exposing (..) -import Task exposing (..) -import Test exposing (..) -import Platform.Cmd exposing (Cmd) -import Json.Decode exposing (Value) -import Test.Runner.Node exposing (run, TestProgram) -import Test.Array as Array -import Test.Basics as Basics -import Test.Bitwise as Bitwise -import Test.Char as Char -import Test.CodeGen as CodeGen -import Test.Dict as Dict -import Test.Maybe as Maybe -import Test.Equality as Equality -import Test.List as List -import Test.Result as Result -import Test.Set as Set -import Test.String as String -import Test.Tuple as Tuple - - -tests : Test -tests = - describe "Elm Standard Library Tests" - [ Array.tests - , Basics.tests - , Bitwise.tests - , Char.tests - , CodeGen.tests - , Dict.tests - , Equality.tests - , List.tests - , Result.tests - , Set.tests - , String.tests - , Maybe.tests - , Tuple.tests - ]