@@ -3088,13 +3088,13 @@ Ran 1 test suite [ELAPSED]: 1 tests passed, 0 failed, 0 skipped (1 total tests)
30883088} ) ;
30893089
30903090// Tests that --opcodes properly errors (fails early) with wrong opcode names
3091- forgetest_init ! ( invalid_opcode_name , |prj, cmd| {
3091+ forgetest_init ! ( opcodes_invalid_name , |prj, cmd| {
30923092 prj. initialize_default_contracts( ) ;
30933093 cmd. args( [ "test" , "--mt" , "test_Increment" , "-vvvvv" , "--opcodes" , "BOGUS" ] )
30943094 . assert_failure( )
30953095 . stderr_eq( str ![ [ r#"
30963096...
3097- error: invalid value 'BOGUS' for '--opcodes <OPCODES>... ': invalid opcode: BOGUS
3097+ error: invalid value 'BOGUS' for '--opcodes <OPCODES>': invalid opcode: BOGUS
30983098
30993099For more information, try '--help'.
31003100
@@ -3113,6 +3113,40 @@ Error: Not enough verbosity. Use -vvvvv to show opcodes.
31133113"# ] ] ) ;
31143114} ) ;
31153115
3116+ // Tests that the test file path is not swallowed by the --opcodes flag
3117+ forgetest_init ! ( opcodes_path_after_flag, |prj, cmd| {
3118+ prj. initialize_default_contracts( ) ;
3119+ cmd. args( [ "test" , "--mt" , "test_Increment" , "-vvvvv" , "--opcodes" , "SSTORE" , "test/Counter.t.sol" ] )
3120+ . assert_success( )
3121+ . stdout_eq( str ![ [ r#"
3122+ ...
3123+ Ran 1 test for test/Counter.t.sol:CounterTest
3124+ [PASS] test_Increment() ([GAS])
3125+ Traces:
3126+ [137242] CounterTest::setUp()
3127+ ├─ [96345] → new Counter@0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f
3128+ │ └─ ← [Return] 481 bytes of code
3129+ ├─ [2592] Counter::setNumber(0)
3130+ │ └─ ← [Stop]
3131+ └─ ← [Stop]
3132+
3133+ [28783] CounterTest::test_Increment()
3134+ ├─ [22418] Counter::increment()
3135+ │ ├─ [20000] SSTORE 0 <- (1)
3136+ │ ├─ storage changes:
3137+ │ │ @ 0: 0 → 1
3138+ │ └─ ← [Stop]
3139+ ├─ [424] Counter::number() [staticcall]
3140+ │ └─ ← [Return] 1
3141+ └─ ← [Stop]
3142+
3143+ Suite result: ok. 1 passed; 0 failed; 0 skipped; [ELAPSED]
3144+
3145+ Ran 1 test suite [ELAPSED]: 1 tests passed, 0 failed, 0 skipped (1 total tests)
3146+
3147+ "# ] ] ) ;
3148+ } ) ;
3149+
31163150// Tests that chained errors are properly displayed.
31173151// <https://github.com/foundry-rs/foundry/issues/9161>
31183152forgetest ! ( displays_chained_error, |prj, cmd| {
0 commit comments