Commit 92a10c78 authored by clabby's avatar clabby

Structure test folder

parent ab4da63b
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.15;
import { Script } from "forge-std/Script.sol";
import { console2 as console } from "forge-std/console2.sol";
import { FaultDisputeGame_Init } from "../test/FaultDisputeGame.t.sol";
import { FaultDisputeGame_Init } from "../test/dispute/FaultDisputeGame.t.sol";
import { DisputeGameFactory } from "../src/dispute/DisputeGameFactory.sol";
import { FaultDisputeGame } from "../src/dispute/FaultDisputeGame.sol";
import { IFaultDisputeGame } from "../src/dispute/interfaces/IFaultDisputeGame.sol";
......
import os
import shutil
def mimic_directory_structure(src_folder, test_folder):
"""
This function takes a source folder and a test folder as input, and restructures
the test folder to match the directory structure of the source folder.
Only moves test files ("<name>.t.sol") at the root level of the `test` folder.
"""
# Walk through the src folder and collect a list of all .sol files
sol_files = []
for root, _, files in os.walk(src_folder):
for file in files:
if file.endswith(".sol"):
sol_files.append(os.path.join(root, file))
# Iterate through each .t.sol file in the test folder
for test_file in os.listdir(test_folder):
if test_file.endswith(".t.sol"):
# Construct the corresponding .sol file name
sol_file = test_file.replace(".t.sol", ".sol")
# Find the full path of the corresponding .sol file in the src folder
src_path = None
for sol_path in sol_files:
if sol_path.endswith(os.path.sep + sol_file):
src_path = sol_path
break
if src_path:
# Calculate the relative path from the src folder to the .sol file
rel_path = os.path.relpath(src_path, src_folder)
# Construct the destination path within the test folder
dest_path = os.path.join(
test_folder, rel_path).replace(".sol", ".t.sol")
# Create the directory structure if it doesn't exist
dest_dir = os.path.dirname(dest_path)
os.makedirs(dest_dir, exist_ok=True)
# Copy the .t.sol file to the destination folder
shutil.move(os.path.join(test_folder, test_file), dest_path)
print(f"Moved {test_file} to {dest_path}")
else:
print(f"No corresponding .sol file found for {test_file}")
# Specify the source and test folder paths
src_folder = "src"
test_folder = "test"
# Call the mimic_directory_structure function
mimic_directory_structure(src_folder, test_folder)
......@@ -3,7 +3,7 @@ pragma solidity ^0.8.15;
import { Test } from "forge-std/Test.sol";
import { Vm } from "forge-std/Vm.sol";
import { DisputeGameFactory_Init } from "test/DisputeGameFactory.t.sol";
import { DisputeGameFactory_Init } from "test/dispute/DisputeGameFactory.t.sol";
import { DisputeGameFactory } from "src/dispute/DisputeGameFactory.sol";
import { FaultDisputeGame } from "src/dispute/FaultDisputeGame.sol";
import { L2OutputOracle } from "src/L1/L2OutputOracle.sol";
......
......@@ -2,7 +2,7 @@
pragma solidity ^0.8.15;
import { Test } from "forge-std/Test.sol";
import { LibClock } from "../src/dispute/lib/LibClock.sol";
import { LibClock } from "src/dispute/lib/LibClock.sol";
import "src/libraries/DisputeTypes.sol";
/// @notice Tests for `LibClock`
......
......@@ -4,7 +4,7 @@ pragma solidity 0.8.15;
import { Test } from "forge-std/Test.sol";
import { Proxy } from "src/universal/Proxy.sol";
import { ProxyAdmin } from "src/universal/ProxyAdmin.sol";
import { SimpleStorage } from "test/Proxy.t.sol";
import { SimpleStorage } from "test/universal/Proxy.t.sol";
import { L1ChugSplashProxy } from "src/legacy/L1ChugSplashProxy.sol";
import { ResolvedDelegateProxy } from "src/legacy/ResolvedDelegateProxy.sol";
import { AddressManager } from "src/legacy/AddressManager.sol";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment