Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
fix wasm tests
Browse files Browse the repository at this point in the history
  • Loading branch information
agryaznov committed Dec 5, 2022
1 parent fcd2c18 commit 4a21ac7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions frame/contracts/src/wasm/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2333,7 +2333,7 @@ mod tests {
let call =
RuntimeCall::System(frame_system::Call::remark { remark: b"Hello World".to_vec() });
let mut ext = MockExt::default();
let result = execute(CODE_CALL_RUNTIME, call.encode(), &mut ext).unwrap();
let result = execute_with_unstable(CODE_CALL_RUNTIME, call.encode(), &mut ext).unwrap();
assert_eq!(*ext.runtime_calls.borrow(), vec![call]);
// 0 = ReturnCode::Success
assert_eq!(u32::from_le_bytes(result.data.try_into().unwrap()), 0);
Expand All @@ -2342,7 +2342,7 @@ mod tests {
#[test]
fn call_runtime_panics_on_invalid_call() {
let mut ext = MockExt::default();
let result = execute(CODE_CALL_RUNTIME, vec![0x42], &mut ext);
let result = execute_with_unstable(CODE_CALL_RUNTIME, vec![0x42], &mut ext);
assert_eq!(
result,
Err(ExecError {
Expand Down Expand Up @@ -2670,15 +2670,15 @@ mod tests {

// value does not exist -> error returned
let input = (63, [1u8; 64]).encode();
let result = execute(CODE, input, &mut ext).unwrap();
let result = execute_with_unstable(CODE, input, &mut ext).unwrap();
assert_eq!(
u32::from_le_bytes(result.data[0..4].try_into().unwrap()),
ReturnCode::KeyNotFound as u32
);

// value did exist -> value returned
let input = (64, [1u8; 64]).encode();
let result = execute(CODE, input, &mut ext).unwrap();
let result = execute_with_unstable(CODE, input, &mut ext).unwrap();
assert_eq!(
u32::from_le_bytes(result.data[0..4].try_into().unwrap()),
ReturnCode::Success as u32
Expand All @@ -2688,7 +2688,7 @@ mod tests {

// value did exist -> length returned (test for 0 sized)
let input = (19, [2u8; 19]).encode();
let result = execute(CODE, input, &mut ext).unwrap();
let result = execute_with_unstable(CODE, input, &mut ext).unwrap();
assert_eq!(
u32::from_le_bytes(result.data[0..4].try_into().unwrap()),
ReturnCode::Success as u32
Expand Down Expand Up @@ -2936,7 +2936,7 @@ mod tests {
"#;

let mut mock_ext = MockExt::default();
execute(CODE, vec![], &mut mock_ext).unwrap();
execute_with_unstable(CODE, vec![], &mut mock_ext).unwrap();
}

#[test]
Expand Down Expand Up @@ -2968,7 +2968,7 @@ mod tests {
"#;

let mut mock_ext = MockExt::default();
execute(CODE, vec![], &mut mock_ext).unwrap();
execute_with_unstable(CODE, vec![], &mut mock_ext).unwrap();
}

/// This test check that an unstable interface cannot be deployed. In case of runtime
Expand Down

0 comments on commit 4a21ac7

Please sign in to comment.