Skip to content

Commit 556b9f4

Browse files
mpizenbergharrysarson
authored andcommitted
Alternative tests scripts based on a package
1 parent 65cea00 commit 556b9f4

File tree

19 files changed

+61
-105
lines changed

19 files changed

+61
-105
lines changed

core-tests/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
.elm

core-tests/elm.json

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"type": "package",
3+
"name": "elm/core-tests",
4+
"summary": "Elm's standard libraries",
5+
"license": "BSD-3-Clause",
6+
"version": "1.0.5",
7+
"elm-version": "0.19.0 <= v < 0.20.0",
8+
"exposed-modules": [
9+
"EmptyPlaceholderModule"
10+
],
11+
"dependencies": {
12+
"elm/core": "1.0.0 <= v < 2.0.0"
13+
},
14+
"test-dependencies": {
15+
"elm/json": "1.1.3 <= v < 2.0.0",
16+
"elm-explorations/test": "1.2.2 <= v < 2.0.0"
17+
}
18+
}

core-tests/run-tests.sh

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
#!/usr/bin/env bash
2+
3+
set -o errexit;
4+
set -o nounset;
5+
6+
# Let the caller supply an ELM_TEST binary if desired.
7+
if [ -z "${ELM_TEST:-}" ]; then
8+
ELM_TEST=elm-test;
9+
fi
10+
11+
# Since elm/core is treated specially by the compiler (it's always
12+
# inserted as a dependency even when not declared explicitly), we use
13+
# a bit of a hack to make the tests run against the local source code
14+
# rather than the elm/core source fetched from package.elm-lang.org.
15+
16+
# Create a local directory where the compiler will look for the
17+
# elm/core source code:
18+
19+
export ELM_HOME="$PWD/.elm";
20+
rm -rf "$ELM_HOME" && mkdir -p "$ELM_HOME";
21+
rm -rf elm-stuff;
22+
23+
# Create a link to the git package
24+
CORE_LINK="${ELM_HOME}/0.19.1/packages/elm/core/1.0.5"
25+
CORE_GIT_DIR="$(dirname $PWD)"
26+
echo;
27+
echo "Linking $CORE_LINK to $CORE_GIT_DIR"
28+
echo;
29+
mkdir -p "$(dirname $CORE_LINK)"
30+
ln -sv "${CORE_LINK}" "${CORE_GIT_DIR}"
31+
rm -vf "${CORE_GIT_DIR}"/*.dat "${CORE_GIT_DIR}"/doc*.json
32+
33+
# Now we can run the tests against the symlinked source code for real.
34+
echo;
35+
echo "running tests ...";
36+
echo;
37+
38+
"${ELM_TEST}" "$@";

tests/tests/Main.elm renamed to core-tests/tests/Main.elm

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,15 @@
1-
module Main exposing (..)
1+
module Main exposing (tests)
22

3-
import Basics exposing (..)
4-
import Task exposing (..)
5-
import Test exposing (..)
6-
import Platform.Cmd exposing (Cmd)
7-
import Json.Decode exposing (Value)
8-
import Test.Runner.Node exposing (run, TestProgram)
3+
import Test exposing (Test)
94
import Test.Array as Array
105
import Test.Basics as Basics
116
import Test.Bitwise as Bitwise
127
import Test.Char as Char
138
import Test.CodeGen as CodeGen
149
import Test.Dict as Dict
15-
import Test.Maybe as Maybe
1610
import Test.Equality as Equality
1711
import Test.List as List
12+
import Test.Maybe as Maybe
1813
import Test.Result as Result
1914
import Test.Set as Set
2015
import Test.String as String
@@ -23,7 +18,7 @@ import Test.Tuple as Tuple
2318

2419
tests : Test
2520
tests =
26-
describe "Elm Standard Library Tests"
21+
Test.describe "Elm Standard Library Tests"
2722
[ Array.tests
2823
, Basics.tests
2924
, Bitwise.tests
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)