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] #[program]
pub mod account_info { pub mod account_info {
use super::*; use super::*;
pub fn initialize(ctx: Context<Initialize>) -> ProgramResult { pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
Ok(()) Ok(())
} }
} }

View File

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

View File

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