From 465866a318a6dd5e35249adea7812ee6e3708de7 Mon Sep 17 00:00:00 2001 From: Jan Civlin <30603832+jcivlin@users.noreply.github.com> Date: Sat, 27 Apr 2024 23:16:10 -0700 Subject: [PATCH] Enabling `expected_failure` with codes in vector_tests (#25) 042624-fix-vector_tests-1: ini --- .../move-stdlib/tests/vector_tests.move | 29 +++++++------------ 1 file changed, 10 insertions(+), 19 deletions(-) diff --git a/external-crates/move/crates/move-stdlib/tests/vector_tests.move b/external-crates/move/crates/move-stdlib/tests/vector_tests.move index 289c84faf0ab7..583a252d1c53d 100644 --- a/external-crates/move/crates/move-stdlib/tests/vector_tests.move +++ b/external-crates/move/crates/move-stdlib/tests/vector_tests.move @@ -6,10 +6,13 @@ module std::vector_tests { struct Droppable has drop {} struct NotDroppable {} - // defined in vm_status.rs + // defined in external-crates/move/crates/move-core-types/src/vm_status.rs const MEMORY_LIMIT_EXCEEDED: u64 = 4028; const UNKNOWN_STATUS: u64 = 18446744073709551615; + // defined in external-crates/move/solana/move-native/src/target_defs.rs + const PANIC_ABORT_CODE: u64 = 101; + #[test] fun test_singleton_contains() { assert!(*V::borrow(&V::singleton(0), 0) == 0, 0); @@ -94,9 +97,7 @@ module std::vector_tests { } #[test] - // TODO enable specific failure - //#[expected_failure(vector_error, minor_status = 1, location = Self)] - #[expected_failure] + #[expected_failure(abort_code = PANIC_ABORT_CODE, location = std::vector)] fun borrow_out_of_range() { let v = V::empty(); V::push_back(&mut v, 7); @@ -139,9 +140,7 @@ module std::vector_tests { } #[test] - // TODO enable specific failure - //#[expected_failure(vector_error, minor_status = 3, location = Self)] - #[expected_failure] + #[expected_failure(abort_code = PANIC_ABORT_CODE, location = std::vector)] fun destroy_non_empty() { let v = V::empty(); V::push_back(&mut v, 42); @@ -162,9 +161,7 @@ module std::vector_tests { } #[test] - // TODO enable specific failure - //#[expected_failure(vector_error, minor_status = 2, location = Self)] - #[expected_failure] + #[expected_failure(abort_code = PANIC_ABORT_CODE, location = std::vector)] fun pop_out_of_range() { let v = V::empty(); V::pop_back(&mut v); @@ -309,18 +306,14 @@ module std::vector_tests { } #[test] - // TODO enable specific failure - //#[expected_failure(vector_error, minor_status = 1, location = Self)] - #[expected_failure] + #[expected_failure(abort_code = PANIC_ABORT_CODE, location = Self)] fun swap_empty() { let v = V::empty(); V::swap(&mut v, 0, 0); } #[test] - // TODO enable specific failure - //#[expected_failure(vector_error, minor_status = 1, location = Self)] - #[expected_failure] + #[expected_failure(abort_code = PANIC_ABORT_CODE, location = Self)] fun swap_out_of_range() { let v = V::empty(); @@ -391,9 +384,7 @@ module std::vector_tests { } #[test] - // TODO enable specific failure - //#[expected_failure(vector_error, minor_status = 1, location = std::vector)] - #[expected_failure] + #[expected_failure(abort_code = PANIC_ABORT_CODE, location = std::vector)] fun swap_remove_out_of_range() { let v = V::empty(); V::push_back(&mut v, 0);