anchor/tests/safety-checks/test.sh

28 lines
552 B
Bash
Executable File

#!/bin/bash
echo "Building programs"
#
# Build the UncheckedAccount variant.
#
pushd programs/unchecked-account/
output=$(anchor build 2>&1 > /dev/null)
if ! [[ $output =~ "Struct field \"unchecked\" is unsafe" ]]; then
echo "Error: expected /// CHECK error"
exit 1
fi
popd
#
# Build the AccountInfo variant.
#
pushd programs/account-info/
output=$(anchor build 2>&1 > /dev/null)
if ! [[ $output =~ "Struct field \"unchecked\" is unsafe" ]]; then
echo "Error: expected /// CHECK error"
exit 1
fi
popd
echo "Success. All builds failed."