test: add multiline flatten test (#1101)
This commit is contained in:
parent
5bbc6c34ab
commit
5eb5baea68
|
@ -70,12 +70,12 @@ harness = false
|
||||||
[[test]]
|
[[test]]
|
||||||
name = "project"
|
name = "project"
|
||||||
path = "tests/project.rs"
|
path = "tests/project.rs"
|
||||||
required-features = ["async", "solc-svm", "project-util"]
|
required-features = ["full", "project-util"]
|
||||||
|
|
||||||
[[test]]
|
[[test]]
|
||||||
name = "mocked"
|
name = "mocked"
|
||||||
path = "tests/mocked.rs"
|
path = "tests/mocked.rs"
|
||||||
required-features = ["async", "solc-svm", "project-util"]
|
required-features = ["full", "project-util"]
|
||||||
|
|
||||||
[features]
|
[features]
|
||||||
default = ["rustls"]
|
default = ["rustls"]
|
||||||
|
|
|
@ -550,6 +550,57 @@ contract Contract {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn can_flatten_multiline() {
|
||||||
|
let project = TempProject::dapptools().unwrap();
|
||||||
|
|
||||||
|
let f = project
|
||||||
|
.add_source(
|
||||||
|
"A",
|
||||||
|
r#"
|
||||||
|
pragma solidity ^0.8.10;
|
||||||
|
import "./C.sol";
|
||||||
|
import {
|
||||||
|
IllegalArgument,
|
||||||
|
IllegalState
|
||||||
|
} from "./Errors.sol";
|
||||||
|
contract A { }
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
project
|
||||||
|
.add_source(
|
||||||
|
"Errors",
|
||||||
|
r#"
|
||||||
|
pragma solidity ^0.8.10;
|
||||||
|
error IllegalArgument();
|
||||||
|
error IllegalState();
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
project
|
||||||
|
.add_source(
|
||||||
|
"C",
|
||||||
|
r#"
|
||||||
|
pragma solidity ^0.8.10;
|
||||||
|
contract C { }
|
||||||
|
"#,
|
||||||
|
)
|
||||||
|
.unwrap();
|
||||||
|
|
||||||
|
let result = project.flatten(&f).unwrap();
|
||||||
|
assert_eq!(
|
||||||
|
result.trim(),
|
||||||
|
r#"pragma solidity ^0.8.10;
|
||||||
|
contract C { }
|
||||||
|
error IllegalArgument();
|
||||||
|
error IllegalState();
|
||||||
|
contract A { }"#
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn can_detect_type_error() {
|
fn can_detect_type_error() {
|
||||||
let project = TempProject::<ConfigurableArtifacts>::dapptools().unwrap();
|
let project = TempProject::<ConfigurableArtifacts>::dapptools().unwrap();
|
||||||
|
|
Loading…
Reference in New Issue