This repository was archived by the owner on Oct 19, 2024. It is now read-only.
File tree 1 file changed +49
-0
lines changed
1 file changed +49
-0
lines changed Original file line number Diff line number Diff line change @@ -2138,6 +2138,55 @@ fn can_checkout_repo() {
2138
2138
let _artifacts = project. artifacts_snapshot ( ) . unwrap ( ) ;
2139
2139
}
2140
2140
2141
+ #[ test]
2142
+ fn can_detect_config_changes ( ) {
2143
+ let mut project = TempProject :: < ConfigurableArtifacts > :: dapptools ( ) . unwrap ( ) ;
2144
+
2145
+ let remapping = project. paths ( ) . libraries [ 0 ] . join ( "remapping" ) ;
2146
+ project
2147
+ . paths_mut ( )
2148
+ . remappings
2149
+ . push ( Remapping :: from_str ( & format ! ( "remapping/={}/" , remapping. display( ) ) ) . unwrap ( ) ) ;
2150
+
2151
+ project
2152
+ . add_source (
2153
+ "Foo" ,
2154
+ r#"
2155
+ pragma solidity ^0.8.10;
2156
+ import "remapping/Bar.sol";
2157
+
2158
+ contract Foo {}
2159
+ "# ,
2160
+ )
2161
+ . unwrap ( ) ;
2162
+ project
2163
+ . add_lib (
2164
+ "remapping/Bar" ,
2165
+ r#"
2166
+ pragma solidity ^0.8.10;
2167
+
2168
+ contract Bar {}
2169
+ "# ,
2170
+ )
2171
+ . unwrap ( ) ;
2172
+
2173
+ let compiled = project. compile ( ) . unwrap ( ) ;
2174
+ assert ! ( !compiled. has_compiler_errors( ) ) ;
2175
+
2176
+ let cache = SolFilesCache :: read ( & project. paths ( ) . cache ) . unwrap ( ) ;
2177
+ assert_eq ! ( cache. files. len( ) , 2 ) ;
2178
+
2179
+ // nothing to compile
2180
+ let compiled = project. compile ( ) . unwrap ( ) ;
2181
+ assert ! ( compiled. is_unchanged( ) ) ;
2182
+
2183
+ project. project_mut ( ) . solc_config . settings . optimizer . enabled = Some ( true ) ;
2184
+
2185
+ let compiled = project. compile ( ) . unwrap ( ) ;
2186
+ assert ! ( !compiled. has_compiler_errors( ) ) ;
2187
+ assert ! ( !compiled. is_unchanged( ) ) ;
2188
+ }
2189
+
2141
2190
#[ test]
2142
2191
fn can_add_basic_contract_and_library ( ) {
2143
2192
let mut project = TempProject :: < ConfigurableArtifacts > :: dapptools ( ) . unwrap ( ) ;
You can’t perform that action at this time.
0 commit comments