Skip to content

Instantly share code, notes, and snippets.

@krisajenkins
Created July 10, 2016 13:42
Show Gist options
  • Save krisajenkins/8b2de1d221f2c26a55b6fa1a02dfc74d to your computer and use it in GitHub Desktop.
Save krisajenkins/8b2de1d221f2c26a55b6fa1a02dfc74d to your computer and use it in GitHub Desktop.
Demostrates a dependency-checking bug in elm-make.
#!/bin/sh
############################################################
# Create a simple working program.
############################################################
cat <<EOF > Foo.elm
module Foo exposing (..)
type alias Foo = Int
EOF
cat << EOF > Bar.elm
module Bar exposing (..)
import Foo exposing (..)
bar : Foo
bar = 42
EOF
############################################################
# Compile successfully.
############################################################
elm make --yes --warn Bar.elm
############################################################
# Alter the program so it's broken.
############################################################
echo >> Bar.elm
cat <<EOF > Foo.elm
module Foo exposing (..)
type alias Foo = String
EOF
############################################################
# Compile. This should fail, but most of the time it won't.
############################################################
elm make --yes --warn Bar.elm
@note89
Copy link

note89 commented Jul 10, 2016

Version that gathers statistics in a stupid way.

#!/bin/sh

############################################################
# Create a simple working program.
############################################################
rm -rf temp
mkdir temp
cd temp
cat <<EOF > Foo.elm
module Foo exposing (..)
type alias Foo = Int
EOF

cat << EOF > Bar.elm
module Bar exposing (..)

import Foo exposing (..)


bar : Foo
bar = 42
EOF

############################################################
# Compile successfully.
############################################################
elm make --yes --warn Bar.elm

############################################################
# Alter the program so it's broken.
############################################################

echo >> Bar.elm

cat <<EOF > Foo.elm
module Foo exposing (..)
type alias Foo = String
EOF

############################################################
# Compile. This should fail, but most of the time it won't.
############################################################
elm make --yes --warn Bar.elm


############################################################
#  Write the results to a temp.file
############################################################
STATUS=$?
cd ..

if [ $STATUS -eq 1 ]
then
  echo "found" >> temp.file
else
  echo "not" >> temp.file
fi

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment