Check error in safety checks test failure (#1571)

This commit is contained in:
Tom Linton 2022-03-09 10:00:25 +13:00 committed by GitHub
parent 6dd0574cca
commit 5c5fa7927f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -5,7 +5,7 @@ declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
#[program]
pub mod account_info {
use super::*;
pub fn initialize(ctx: Context<Initialize>) -> ProgramResult {
pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
Ok(())
}
}

View File

@ -5,7 +5,7 @@ declare_id!("Fg6PaFpoGXkYsidMpWTK6W2BeZ7FEfcYkg476zPFsLnS");
#[program]
pub mod unchecked_account {
use super::*;
pub fn initialize(ctx: Context<Initialize>) -> ProgramResult {
pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
Ok(())
}
}

View File

@ -6,9 +6,9 @@ echo "Building programs"
# Build the UncheckedAccount variant.
#
pushd programs/unchecked-account/
anchor build
if [ $? -eq 0 ]; then
echo "Error: expected failure"
output=$(anchor build 2>&1 > /dev/null)
if ! [[ $output =~ "Struct field \"unchecked\" is unsafe" ]]; then
echo "Error: expected /// CHECK error"
exit 1
fi
popd
@ -17,9 +17,9 @@ popd
# Build the AccountInfo variant.
#
pushd programs/account-info/
anchor build
if [ $? -eq 0 ]; then
echo "Error: expected failure"
output=$(anchor build 2>&1 > /dev/null)
if ! [[ $output =~ "Struct field \"unchecked\" is unsafe" ]]; then
echo "Error: expected /// CHECK error"
exit 1
fi
popd