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

spec include multifile tests #29

Merged
merged 2 commits into from
May 23, 2023
Merged
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
5 changes: 4 additions & 1 deletion src/spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,10 @@ impl ParsedContract {
fn contract_name_from_file(&self) -> String {
let file_stem = self.path.file_stem().unwrap().to_str().unwrap().to_string();
if file_stem.ends_with(".t") {
file_stem[0..file_stem.len() - 2].to_string() // Slice off the ".t" at the end.
// Get everything before the first dot, slicing off `.t`. This enables support for both
// (1) putting all tests in MyContract.t.sol, and (2) splitting up tests across multiple
// files such as `MyContract.SomeFunction.t.sol`.
file_stem.split('.').next().unwrap().to_string()
} else {
file_stem
}
Expand Down