Skip to content

Commit

Permalink
Merge branch 'dani/sol-fn-snake' into dani/sol-stmts
Browse files Browse the repository at this point in the history
  • Loading branch information
DaniPopes committed Aug 5, 2023
2 parents b014827 + c72a924 commit 96e085b
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
2 changes: 1 addition & 1 deletion crates/sol-macro/src/expand/contract.rs
Original file line number Diff line number Diff line change
Expand Up @@ -435,7 +435,7 @@ fn snakify(s: &str) -> String {

let mut num_starts = vec![];
for (pos, c) in output.iter().enumerate() {
if pos != 0 && c.is_digit(10) && !output[pos - 1].is_digit(10) {
if pos != 0 && c.is_ascii_digit() && !output[pos - 1].is_ascii_digit() {
num_starts.push(pos);
}
}
Expand Down
17 changes: 17 additions & 0 deletions crates/sol-types/tests/sol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,23 @@ fn empty_call() {
let depositCall {} = depositCall::decode_raw(&[], true).unwrap();
}

#[test]
fn function_names() {
sol! {
contract LeadingUnderscores {
function f();
function _f();
function __f();
}
}
use LeadingUnderscores::*;

let call = LeadingUnderscoresCalls::f(fCall {});
assert!(call.is_f());
assert!(!call.is__f());
assert!(!call.is___f());
}

#[test]
fn abigen_sol_multicall() {
sol!("../syn-solidity/tests/contracts/Multicall.sol");
Expand Down

0 comments on commit 96e085b

Please sign in to comment.