From 48bde8cc5aacabee1a2f7c06a1165985c8981e5f Mon Sep 17 00:00:00 2001 From: grandizzy Date: Fri, 8 Nov 2024 15:58:19 +0200 Subject: [PATCH] Add Json test --- crates/forge/tests/cli/cmd.rs | 50 +++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/crates/forge/tests/cli/cmd.rs b/crates/forge/tests/cli/cmd.rs index 22b00f420d1b..438adb28dbaf 100644 --- a/crates/forge/tests/cli/cmd.rs +++ b/crates/forge/tests/cli/cmd.rs @@ -2897,4 +2897,54 @@ Suite result: ok. 1 passed; 0 failed; 0 skipped; [ELAPSED] ... "#]]); + + cmd.forge_fuse() + .args(["test", "--mt", "test_fallback_gas_report", "--gas-report", "--json"]) + .assert_success() + .stdout_eq( + str![[r#" +[ + { + "contract": "test/DelegateProxyTest.sol:DelegateProxy", + "deployment": { + "gas": 108698, + "size": 315 + }, + "functions": { + "deposit()": { + "calls": 1, + "min": 21160, + "mean": 21160, + "median": 21160, + "max": 21160 + }, + "fallback()": { + "calls": 1, + "min": 29396, + "mean": 29396, + "median": 29396, + "max": 29396 + } + } + }, + { + "contract": "test/DelegateProxyTest.sol:ProxiedContract", + "deployment": { + "gas": 106511, + "size": 276 + }, + "functions": { + "deposit(uint256)": { + "calls": 1, + "min": 3320, + "mean": 3320, + "median": 3320, + "max": 3320 + } + } + } +] +"#]] + .is_json(), + ); });