Files
revive/crates/resolc/src/tests/unit/standard_json.rs
T
xermicus 94ec34c4d5 Separate compilation and linker phases (#376)
Separate between compilation and linker phases to allow deploy time
linking and back-porting era compiler changes to fix #91. Unlinked
contract binaries (caused by missing libraries or missing factory
dependencies in turn) are emitted as raw ELF object.

Few drive by fixes:
- #98
- A compiler panic on missing libraries definitions.
- Fixes some incosistent type forwarding in JSON output (empty string
vs. null object).
- Remove the unused fallback for size optimization setting.
- Remove the broken `--lvm-ir`  mode.
- CI workflow fixes.

---------

Signed-off-by: Cyrill Leutwiler <bigcyrill@hotmail.com>
Signed-off-by: xermicus <bigcyrill@hotmail.com>
Signed-off-by: xermicus <cyrill@parity.io>
2025-09-27 20:52:22 +02:00

54 lines
1.4 KiB
Rust

use std::path::PathBuf;
use revive_solc_json_interface::SolcStandardJsonInput;
use crate::test_utils::build_yul_standard_json;
#[test]
fn standard_json_yul_solc() {
let solc_input = SolcStandardJsonInput::try_from(Some(
PathBuf::from("src/tests/data/standard_json/yul_solc.json").as_path(),
))
.unwrap();
let solc_output = build_yul_standard_json(solc_input).unwrap();
assert!(!solc_output
.contracts
.get("Test")
.expect("The `Test` contract is missing")
.get("Return")
.expect("The `Return` contract is missing")
.evm
.as_ref()
.expect("The `evm` field is missing")
.bytecode
.as_ref()
.expect("The `bytecode` field is missing")
.object
.is_empty())
}
#[test]
fn standard_json_yul_solc_urls() {
let solc_input = SolcStandardJsonInput::try_from(Some(
PathBuf::from("src/tests/data/standard_json/yul_solc_urls.json").as_path(),
))
.unwrap();
let solc_output = build_yul_standard_json(solc_input).unwrap();
assert!(!solc_output
.contracts
.get("Test")
.expect("The `Test` contract is missing")
.get("Return")
.expect("The `Return` contract is missing")
.evm
.as_ref()
.expect("The `evm` field is missing")
.bytecode
.as_ref()
.expect("The `bytecode` field is missing")
.object
.is_empty())
}