forked from elm/json
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix tests With this commit, tests run again (I believe they last run with elm 0.18.0). I have used the same approach as elm/core#1017 to get these tests running.
- Loading branch information
1 parent
24a7c9a
commit eda02af
Showing
5 changed files
with
119 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,4 @@ | ||
elm-stuff | ||
elm-stuff/ | ||
/artifacts.dat | ||
/docs.json | ||
/tests/.elm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
language: elm | ||
|
||
elm: | ||
- latest | ||
|
||
elm_test: latest | ||
|
||
elm_format: latest | ||
|
||
script: | ||
- bash tests/run-tests.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"type": "application", | ||
"source-directories": [], | ||
"elm-version": "0.19.1", | ||
"dependencies": { | ||
"direct": { | ||
"elm/core": "1.0.4", | ||
"elm/json": "1.1.3" | ||
}, | ||
"indirect": {} | ||
}, | ||
"test-dependencies": { | ||
"direct": { | ||
"elm-explorations/test": "1.2.2" | ||
}, | ||
"indirect": { | ||
"elm/html": "1.0.0", | ||
"elm/random": "1.0.0", | ||
"elm/time": "1.0.0", | ||
"elm/virtual-dom": "1.0.2" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -o errexit; | ||
set -o nounset; | ||
|
||
#let the caller supply an ELM_TEST binary if desired | ||
if [ -z "${ELM_TEST:-}" ]; then | ||
ELM_TEST=elm-test; | ||
fi | ||
|
||
# since elm/json 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/json source fetched from package.elm-lang.org. | ||
|
||
# create a local directory where the compiler will look for the | ||
# elm/json source code: | ||
|
||
DIR="$(dirname $0)"; | ||
|
||
cd "$DIR"; | ||
|
||
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/json 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/json hosted on package.elm-lang.org | ||
|
||
"${ELM_TEST}" tests/Test/Json.elm --fuzz=1 > /dev/null || true; | ||
|
||
# clear out the copy of elm/json 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/json/)" | ||
CORE_PACKAGE_DIR="${ELM_HOME}/0.19.1/packages/elm/json/$VERSION_DIR" | ||
CORE_GIT_DIR="$(dirname $PWD)" | ||
|
||
echo; | ||
echo "Linking $CORE_PACKAGE_DIR to $CORE_GIT_DIR" | ||
echo; | ||
|
||
rm -rf "$CORE_PACKAGE_DIR" | ||
ln -sv "$CORE_GIT_DIR" "$CORE_PACKAGE_DIR" | ||
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 | ||
|
||
echo; | ||
echo "running tests ..."; | ||
echo; | ||
|
||
"${ELM_TEST}" tests/Test/Json.elm "$@"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters