Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor improvements to testing package #1212

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/testing/src/common.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use starknet::{ContractAddress, SyscallResult};

/// Converts panic data into a string (ByteArray).
///
/// panic_data is expected to be a valid serialized byte array with an extra
/// `panic_data` is expected to be a valid serialized byte array with an extra
/// felt252 at the beginning, which is the BYTE_ARRAY_MAGIC.
pub fn panic_data_to_byte_array(panic_data: Array<felt252>) -> ByteArray {
let mut panic_data = panic_data.span();
Expand Down Expand Up @@ -39,7 +39,7 @@ pub fn to_base_16_string_no_padding(value: felt252) -> ByteArray {
}

/// A helper trait that enables any value that can be converted to `felt252` to be represented
/// as a `base16` string(including the `0x` prefix).
/// as a `base16` string (including the `0x` prefix).
#[generate_trait]
pub impl IntoBase16String<T, +Into<T, felt252>> of IntoBase16StringTrait<T> {
fn into_base_16_string(self: T) -> ByteArray {
Expand Down
3 changes: 3 additions & 0 deletions packages/testing/src/events.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ pub impl EventSpyExtImpl of EventSpyExt {
}

/// Ensures that `from_address` has emitted the `expected_event`.
/// This assertion increments the event offset which essentially
andrew-fleming marked this conversation as resolved.
Show resolved Hide resolved
/// consumes the event in the first position of the offset. This means
/// that events must be asserted in the order that they're emitted.
fn assert_emitted_single<T, +starknet::Event<T>, +Drop<T>>(
ref self: EventSpy, from_address: ContractAddress, expected_event: T
) {
Expand Down