mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-04-22 10:17:56 +00:00
98b62d705f
* Generate schema for the metadata file * Groundwork for dyn traits * Make the ethereum node trait object compatible * Allow for compilers to be created in the dyn trait * Add more identifiers to the platform * Implement the dyn compiler trait for compilers * Support the dyn compiler in the builder pattern * Introduce a geth platform * Provide a common node implementation for substrate chains * Add all of the platforms that we support * Add a way to convert platform identifier into a platform * Replace infra with the dyn infra * Remoe all references to leader and follower * Remove the old traits * Remove an un-needed dependency * Update the default values for the platforms * Final set of renames * Update the default values of the cli * Update tests
89 lines
2.6 KiB
Rust
89 lines
2.6 KiB
Rust
use std::path::PathBuf;
|
|
|
|
use revive_dt_common::types::VersionOrRequirement;
|
|
use revive_dt_compiler::{Compiler, revive_resolc::Resolc, solc::Solc};
|
|
use revive_dt_config::TestExecutionContext;
|
|
use semver::Version;
|
|
|
|
#[tokio::test]
|
|
async fn contracts_can_be_compiled_with_solc() {
|
|
// Arrange
|
|
let args = TestExecutionContext::default();
|
|
let solc = Solc::new(&args, VersionOrRequirement::Version(Version::new(0, 8, 30)))
|
|
.await
|
|
.unwrap();
|
|
|
|
// Act
|
|
let output = Compiler::new()
|
|
.with_source("./tests/assets/array_one_element/callable.sol")
|
|
.unwrap()
|
|
.with_source("./tests/assets/array_one_element/main.sol")
|
|
.unwrap()
|
|
.try_build(&solc)
|
|
.await;
|
|
|
|
// Assert
|
|
let output = output.expect("Failed to compile");
|
|
assert_eq!(output.contracts.len(), 2);
|
|
|
|
let main_file_contracts = output
|
|
.contracts
|
|
.get(
|
|
&PathBuf::from("./tests/assets/array_one_element/main.sol")
|
|
.canonicalize()
|
|
.unwrap(),
|
|
)
|
|
.unwrap();
|
|
let callable_file_contracts = output
|
|
.contracts
|
|
.get(
|
|
&PathBuf::from("./tests/assets/array_one_element/callable.sol")
|
|
.canonicalize()
|
|
.unwrap(),
|
|
)
|
|
.unwrap();
|
|
assert!(main_file_contracts.contains_key("Main"));
|
|
assert!(callable_file_contracts.contains_key("Callable"));
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn contracts_can_be_compiled_with_resolc() {
|
|
// Arrange
|
|
let args = TestExecutionContext::default();
|
|
let resolc = Resolc::new(&args, VersionOrRequirement::Version(Version::new(0, 8, 30)))
|
|
.await
|
|
.unwrap();
|
|
|
|
// Act
|
|
let output = Compiler::new()
|
|
.with_source("./tests/assets/array_one_element/callable.sol")
|
|
.unwrap()
|
|
.with_source("./tests/assets/array_one_element/main.sol")
|
|
.unwrap()
|
|
.try_build(&resolc)
|
|
.await;
|
|
|
|
// Assert
|
|
let output = output.expect("Failed to compile");
|
|
assert_eq!(output.contracts.len(), 2);
|
|
|
|
let main_file_contracts = output
|
|
.contracts
|
|
.get(
|
|
&PathBuf::from("./tests/assets/array_one_element/main.sol")
|
|
.canonicalize()
|
|
.unwrap(),
|
|
)
|
|
.unwrap();
|
|
let callable_file_contracts = output
|
|
.contracts
|
|
.get(
|
|
&PathBuf::from("./tests/assets/array_one_element/callable.sol")
|
|
.canonicalize()
|
|
.unwrap(),
|
|
)
|
|
.unwrap();
|
|
assert!(main_file_contracts.contains_key("Main"));
|
|
assert!(callable_file_contracts.contains_key("Callable"));
|
|
}
|