forked from arialang/aria
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patht
More file actions
executable file
·67 lines (59 loc) · 2.38 KB
/
Copy patht
File metadata and controls
executable file
·67 lines (59 loc) · 2.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
set -e
SELF_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
ARIA_BUILD_CONFIG="${ARIA_BUILD_CONFIG:-dev}"
ARIA_LIB_DIR="${ARIA_LIB_DIR:-${SELF_DIR}/lib:${SELF_DIR}/lib-test}"
ARIA_TEST_DIR="${ARIA_TEST_DIR:-${SELF_DIR}/tests}"
RUST_MIN_STACK=16777216
cargo build --workspace --profile "$ARIA_BUILD_CONFIG"
ARIA_LIB_DIR="$ARIA_LIB_DIR" cargo test --profile "$ARIA_BUILD_CONFIG" --package vm-lib
ARIA_LIB_DIR="$ARIA_LIB_DIR" cargo test --profile "$ARIA_BUILD_CONFIG" --package aria-bin
set +e
ARIA_LIB_DIR="$ARIA_LIB_DIR" cargo run --profile "$ARIA_BUILD_CONFIG" --package aria-bin -- vm-lib/src/builtins/test_exit.aria
EXIT_CODE=$?
set -e
if [ $EXIT_CODE -ne 42 ]; then
echo "❌ test_exit.aria exited with code $EXIT_CODE, expected 42"
exit 1
else
echo "✅ test_exit.aria exited with code $EXIT_CODE"
fi
set +e
ARIA_LIB_DIR="$ARIA_LIB_DIR" cargo run --profile "$ARIA_BUILD_CONFIG" --package aria-bin -- aria-bin/test_assert.aria
EXIT_CODE=$?
set -e
if [ $EXIT_CODE -ne 1 ]; then
echo "❌ test_assert.aria exited with code $EXIT_CODE, expected 1"
exit 1
else
echo "✅ test_assert.aria exited with code $EXIT_CODE"
fi
set +e
ARIA_LIB_DIR="$ARIA_LIB_DIR" cargo run --profile "$ARIA_BUILD_CONFIG" --package aria-bin -- aria-bin/test_uncaught_exception.aria
EXIT_CODE=$?
set -e
if [ $EXIT_CODE -ne 1 ]; then
echo "❌ test_uncaught_exception.aria exited with code $EXIT_CODE, expected 1"
exit 1
else
echo "✅ test_uncaught_exception.aria exited with code $EXIT_CODE"
fi
set +e
ERROR_REPORTING_TEMPLATE="$SELF_DIR"/aria-bin/src/error_reporting_test/expected.txt
ERROR_REPORTING_OUTPUT=$(ARIA_LIB_DIR_EXTRA="$SELF_DIR"/aria-bin/src/error_reporting_test \
ARIA_LIB_DIR="$ARIA_LIB_DIR" \
cargo run --profile "$ARIA_BUILD_CONFIG" \
--package aria-bin -- \
"$SELF_DIR"/aria-bin/src/error_reporting_test/main.aria 2>&1)
set -e
echo "$ERROR_REPORTING_OUTPUT" | awk '
match($0, /\/[^[:space:]]+:[0-9]+:[0-9]+/) {
path = substr($0, RSTART, RLENGTH)
n = split(path, parts, "/")
print parts[n]
}
' | diff -u "$ERROR_REPORTING_TEMPLATE" - && echo "OK" || { echo "Mismatch - actual output ${ERROR_REPORTING_OUTPUT}"; exit 1; }
ARIA_TEST_DIR="$ARIA_TEST_DIR" \
ARIA_LIB_DIR="$ARIA_LIB_DIR" \
RUST_MIN_STACK="$RUST_MIN_STACK" \
cargo run --profile "$ARIA_BUILD_CONFIG" --package test-bin -- --path "tests/**/*.aria" --verbose "$@"