Skip to content

Commit

Permalink
Remove forge-std submodule in favor of testdata's Cheats.sol
Browse files Browse the repository at this point in the history
  • Loading branch information
clabby committed Dec 6, 2022
1 parent 73cf641 commit 0047d51
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

18 changes: 9 additions & 9 deletions chisel/src/session_source.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use solang_parser::pt;
use std::{collections::HashMap, fs, path::PathBuf};

/// Solidity source for the `Vm` interface in [forge-std](https://github.com/foundry-rs/forge-std)
static VM_SOURCE: &str = include_str!("../../testdata/lib/forge-std/src/Vm.sol");
static VM_SOURCE: &str = include_str!("../../testdata/cheats/Cheats.sol");

/// Intermediate output for the compiled [SessionSource]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
Expand Down Expand Up @@ -369,11 +369,11 @@ contract {} is Script {{
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^{major}.{minor}.{patch};
import {{Vm}} from "forge-std/Vm.sol";
import {{Cheats}} from "forge-std/Vm.sol";
{}
contract {} {{
Vm internal constant vm = Vm(address(uint160(uint256(keccak256("hevm cheat code")))));
Cheats internal constant vm = Cheats(address(uint160(uint256(keccak256("hevm cheat code")))));
{}
/// @notice REPL contract entry point
Expand Down Expand Up @@ -401,9 +401,9 @@ contract {} {{
.into_iter()
.filter_map(|sup| match sup {
pt::SourceUnitPart::ImportDirective(i) => match i {
pt::Import::Plain(s, _) |
pt::Import::Rename(s, _, _) |
pt::Import::GlobalSymbol(s, _, _) => {
pt::Import::Plain(s, _)
| pt::Import::Rename(s, _, _)
| pt::Import::GlobalSymbol(s, _, _) => {
let path = PathBuf::from(s.string);

match fs::read_to_string(path) {
Expand Down Expand Up @@ -532,13 +532,13 @@ pub fn parse_fragment(
let mut base = SessionSource::new(solc, config);

if base.clone().with_run_code(buffer).parse().is_ok() {
return Some(ParseTreeFragment::Function)
return Some(ParseTreeFragment::Function);
}
if base.clone().with_top_level_code(buffer).parse().is_ok() {
return Some(ParseTreeFragment::Contract)
return Some(ParseTreeFragment::Contract);
}
if base.with_global_code(buffer).parse().is_ok() {
return Some(ParseTreeFragment::Source)
return Some(ParseTreeFragment::Source);
}

None
Expand Down
1 change: 0 additions & 1 deletion testdata/lib/forge-std
Submodule forge-std deleted from 054a25

0 comments on commit 0047d51

Please sign in to comment.