Skip to content

Commit 488a4cd

Browse files
committed
add test
1 parent 814a4d9 commit 488a4cd

File tree

6 files changed

+35
-1
lines changed

6 files changed

+35
-1
lines changed

Cargo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,3 +62,5 @@ yansi = "1.0"
6262
# async
6363
futures-util = "0.3"
6464
tokio = { version = "1.35", features = ["rt-multi-thread"] }
65+
66+
snapbox = "0.6.9"

crates/compilers/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ fd-lock = "4.0.0"
6161
tokio = { version = "1.35", features = ["rt-multi-thread", "macros"] }
6262
reqwest = "0.12"
6363
tempfile = "3.9"
64+
snapbox.workspace = true
6465
foundry-compilers-core = { workspace = true, features = ["test-utils"] }
6566

6667
[features]

crates/compilers/src/resolver/mod.rs

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -560,7 +560,7 @@ impl<L: Language, D: ParsedSource<Language = L>> Graph<D> {
560560
line.push_str(&format!(" {req}"));
561561
}
562562

563-
write!(f, "{} ", line.paint(color))
563+
write!(f, "{}", line.paint(color))
564564
};
565565
format_node(idx, f)?;
566566
write!(f, " imports:")?;
@@ -1052,6 +1052,32 @@ src/Dapp.t.sol >=0.6.6
10521052
);
10531053
}
10541054

1055+
#[test]
1056+
#[cfg(feature = "svm-solc")]
1057+
fn test_print_unresolved() {
1058+
let root =
1059+
Path::new(env!("CARGO_MANIFEST_DIR")).join("../../test-data/incompatible-pragmas");
1060+
let paths = ProjectPathsConfig::dapptools(&root).unwrap();
1061+
let graph = Graph::<SolData>::resolve(&paths).unwrap();
1062+
let Err(SolcError::Message(err)) = graph.get_input_node_versions(
1063+
false,
1064+
&Default::default(),
1065+
&crate::solc::SolcCompiler::AutoDetect,
1066+
) else {
1067+
panic!("expected error");
1068+
};
1069+
1070+
snapbox::assert_data_eq!(
1071+
err,
1072+
snapbox::str![[r#"
1073+
Found incompatible versions:
1074+
src/A.sol =0.8.25 imports:
1075+
src/B.sol
1076+
src/C.sol =0.7.0
1077+
"#]]
1078+
);
1079+
}
1080+
10551081
#[cfg(target_os = "linux")]
10561082
#[test]
10571083
fn can_read_different_case() {
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pragma solidity 0.8.25;
2+
3+
import "./B.sol";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
import "./C.sol";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pragma solidity 0.7.0;

0 commit comments

Comments
 (0)