@@ -716,7 +716,7 @@ fn can_flatten_on_solang_failure() {
716716 r#"// SPDX-License-Identifier: UNLICENSED
717717pragma solidity ^0.8.10;
718718
719- library Lib {}
719+ library Lib {}
720720"# ,
721721 )
722722 . unwrap ( ) ;
@@ -748,7 +748,7 @@ pragma solidity ^0.8.10;
748748
749749// src/Lib.sol
750750
751- library Lib {}
751+ library Lib {}
752752
753753// src/Contract.sol
754754
@@ -2980,17 +2980,17 @@ fn can_parse_notice() {
29802980
29812981 /**
29822982 * @notice hello
2983- */
2983+ */
29842984 constructor(string memory _greeting) public {
29852985 greeting = _greeting;
29862986 }
2987-
2987+
29882988 /**
29892989 * @notice hello
29902990 */
29912991 function xyz() public {
29922992 }
2993-
2993+
29942994 /// @notice hello
29952995 function abc() public {
29962996 }
@@ -3986,3 +3986,39 @@ fn test_can_compile_multi() {
39863986 assert ! ( compiled. find( & root. join( "src/Counter.vy" ) , "Counter" ) . is_some( ) ) ;
39873987 compiled. assert_success ( ) ;
39883988}
3989+
3990+ // This is a reproduction of https://github.com/foundry-rs/compilers/issues/47
3991+ #[ cfg( feature = "svm-solc" ) ]
3992+ #[ test]
3993+ fn remapping_trailing_slash_issue47 ( ) {
3994+ use std:: sync:: Arc ;
3995+
3996+ use foundry_compilers_artifacts:: { EvmVersion , Source , Sources } ;
3997+
3998+ let mut sources = Sources :: new ( ) ;
3999+ sources. insert (
4000+ PathBuf :: from ( "./C.sol" ) ,
4001+ Source {
4002+ content : Arc :: new ( r#"import "@project/D.sol"; contract C {}"# . to_string ( ) ) ,
4003+ kind : Default :: default ( ) ,
4004+ } ,
4005+ ) ;
4006+ sources. insert (
4007+ PathBuf :: from ( "./D.sol" ) ,
4008+ Source { content : Arc :: new ( r#"contract D {}"# . to_string ( ) ) , kind : Default :: default ( ) } ,
4009+ ) ;
4010+
4011+ let mut settings = Settings :: default ( ) ;
4012+ settings. evm_version = Some ( EvmVersion :: Byzantium ) ;
4013+ settings. remappings . push ( Remapping {
4014+ context : None ,
4015+ name : "@project" . into ( ) ,
4016+ path : "." . into ( ) ,
4017+ } ) ;
4018+ let input = SolcInput { language : SolcLanguage :: Solidity , sources, settings } ;
4019+ println ! ( "{:?}" , serde_json:: to_string( & input) ) ;
4020+ let compiler = Solc :: find_or_install ( & Version :: new ( 0 , 6 , 8 ) ) . unwrap ( ) ;
4021+ let output = compiler. compile_exact ( & input) . unwrap ( ) ;
4022+ println ! ( "{:?}" , output. errors) ;
4023+ assert ! ( !output. has_error( ) ) ;
4024+ }
0 commit comments