-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
native string utils cheatcodes #6891
Merged
mattsse
merged 7 commits into
foundry-rs:master
from
1010adigupta:native-string-utils-cheatcodes
Jan 25, 2024
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
dccaf5b
string utils cheatcodes created
1010adigupta 4c785d1
fmt: run rustfmt
1010adigupta 304e175
tests: solidity tests added
1010adigupta 7fe9a27
cargo cheats
mattsse ae26a18
update
1010adigupta 4589f84
update
1010adigupta 59a15ff
chore: update defs
Evalir File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1077,6 +1077,22 @@ interface Vm { | |
#[cheatcode(group = String)] | ||
function parseBool(string calldata stringifiedValue) external pure returns (bool parsedValue); | ||
|
||
/// Converts the given `string` value to Lowercase. | ||
#[cheatcode(group = String)] | ||
function toLowercase(string calldata stringifiedValue) external pure returns (string memory stringifiedValue); | ||
/// Converts the given `string` value to Uppercase. | ||
#[cheatcode(group = String)] | ||
function toUppercase(string calldata stringifiedValue) external pure returns (string memory stringifiedValue); | ||
/// Trims leading and trailing whitespace from the given `string` value. | ||
#[cheatcode(group = String)] | ||
function trim(string calldata stringifiedValue) external pure returns (string memory stringifiedValue); | ||
/// Replaces occurrences of `from` in the given `string` with `to`. | ||
#[cheatcode(group = String)] | ||
function replace(string calldata stringifiedValue, string calldata from, string calldata to) external pure returns (string memory stringifiedValue); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as https://github.com/foundry-rs/foundry/pull/6891/files#r1465480622 |
||
/// Splits the given `string` into an array of strings divided by the `delimiter`. | ||
#[cheatcode(group = String)] | ||
function split(string calldata stringifiedValue, string calldata delimiter) external pure returns (string[] memory stringifiedValues); | ||
|
||
// ======== JSON Parsing and Manipulation ======== | ||
|
||
// -------- Reading -------- | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tested in forge-std to confirm, and this will error with
identifier already declared
in solidity since thestringifiedValue
name is reused. Suggested var names for all sigs: