test.sh 765 B

12345678910111213141516171819202122232425262728293031323334353637
  1. #!/bin/bash
  2. echo "Building programs"
  3. #
  4. # Build the UncheckedAccount variant.
  5. #
  6. pushd programs/unchecked-account/
  7. output=$(anchor build 2>&1 > /dev/null)
  8. if ! [[ $output =~ "Struct field \"unchecked\" is unsafe" ]]; then
  9. echo "Error: expected /// CHECK error"
  10. exit 1
  11. fi
  12. popd
  13. #
  14. # Build the AccountInfo variant.
  15. #
  16. pushd programs/account-info/
  17. output=$(anchor build 2>&1 > /dev/null)
  18. if ! [[ $output =~ "Struct field \"unchecked\" is unsafe" ]]; then
  19. echo "Error: expected /// CHECK error"
  20. exit 1
  21. fi
  22. popd
  23. #
  24. # Build the control variant.
  25. #
  26. pushd programs/ignore-non-accounts/
  27. if ! anchor build ; then
  28. echo "Error: anchor build failed when it shouldn't have"
  29. exit 1
  30. fi
  31. popd
  32. echo "Success. As expected, all builds failed that were supposed to fail."