@@ -66,6 +66,46 @@ const COUNTER_B: &str = r#"
66
66
}
67
67
"# ;
68
68
69
+ const COUNTER_WITH_CONST : & str = r#"
70
+ // SPDX-License-Identifier: MIT
71
+ pragma solidity ^0.8.13;
72
+
73
+ uint256 constant MAX = 1000000;
74
+
75
+ contract Counter {
76
+ uint256 public number;
77
+
78
+ function setNumber(uint256 newNumber) public {
79
+ number = newNumber;
80
+ }
81
+
82
+ function increment() public {
83
+ number++;
84
+ }
85
+ }
86
+ "# ;
87
+
88
+ const COUNTER_TEST_WITH_CONST : & str = r#"
89
+ // SPDX-License-Identifier: MIT
90
+ pragma solidity ^0.8.13;
91
+
92
+ import { Counter, MAX } from "../src/Counter.sol";
93
+
94
+ contract CounterTest {
95
+ Counter public counter;
96
+
97
+ function setUp() public {
98
+ counter = new Counter();
99
+ }
100
+
101
+ function testFuzz_setNumber(uint256[MAX] calldata numbers) public {
102
+ for (uint256 i = 0; i < numbers.length; ++i) {
103
+ counter.setNumber(numbers[i]);
104
+ }
105
+ }
106
+ }
107
+ "# ;
108
+
69
109
forgetest ! ( can_use_config, |prj, cmd| {
70
110
prj. wipe_contracts( ) ;
71
111
prj. add_source( "ContractWithLints" , CONTRACT ) . unwrap( ) ;
@@ -476,6 +516,20 @@ note[mixed-case-variable]: mutable variables should use mixedCase
476
516
] ) ;
477
517
} ) ;
478
518
519
+ // <https://github.com/foundry-rs/foundry/issues/11392>
520
+ forgetest ! ( can_lint_param_constants, |prj, cmd| {
521
+ prj. wipe_contracts( ) ;
522
+ prj. add_source( "Counter" , COUNTER_WITH_CONST ) . unwrap( ) ;
523
+ prj. add_test( "CounterTest" , COUNTER_TEST_WITH_CONST ) . unwrap( ) ;
524
+
525
+ cmd. forge_fuse( ) . args( [ "build" ] ) . assert_success( ) . stdout_eq( str ![ [ r#"
526
+ [COMPILING_FILES] with [SOLC_VERSION]
527
+ [SOLC_VERSION] [ELAPSED]
528
+ Compiler run successful!
529
+
530
+ "# ] ] ) ;
531
+ } ) ;
532
+
479
533
// ------------------------------------------------------------------------------------------------
480
534
481
535
#[ tokio:: test]
0 commit comments