Skip to content

Commit

Permalink
add unit test for Selector::hex_lits method
Browse files Browse the repository at this point in the history
  • Loading branch information
Robbepop committed Sep 20, 2021
1 parent 802684d commit f6a900a
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions crates/lang/ir/src/ir/selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,22 @@ impl From<[u8; 4]> for Selector {
Self::from_bytes(bytes)
}
}

#[cfg(test)]
mod tests {
use super::*;

#[test]
fn hex_lits_works() {
let hex_lits = Selector::from_bytes([0xC0, 0xDE, 0xCA, 0xFE]).hex_lits();
assert_eq!(
hex_lits,
[
syn::parse_quote! { 0xC0_u8 },
syn::parse_quote! { 0xDE_u8 },
syn::parse_quote! { 0xCA_u8 },
syn::parse_quote! { 0xFE_u8 },
]
)
}
}

0 comments on commit f6a900a

Please sign in to comment.