1#!/bin/sh
2
3set -eu
4
5GLEAM_COMMAND=${GLEAM_COMMAND:-"cargo run --quiet --"}
6
7g() {
8 echo "Running: $GLEAM_COMMAND $@"
9 $GLEAM_COMMAND "$@"
10}
11
12echo Resetting the build directory to get to a known state
13rm -fr build
14
15echo This should succeed regardless of target as it is a dependency module
16g run --module=hello_joe
17g run --module=hello_joe --target=erlang
18g run --module=hello_joe --target=javascript
19
20echo Building and running for JavaScript should succeed
21g build --target=javascript
22g run --target=javascript
23
24echo Building for Erlang should fail, even if previously a Erlang dependency was built
25if g build --target=erlang; then
26 echo "Expected build to fail"
27 exit 1
28fi
29
30echo Running for Erlang should fail, even if previously a Erlang dependency was built
31if g run --target=erlang; then
32 echo "Expected run to fail"
33 exit 1
34fi
35
36echo
37echo Success! 💖
38echo