fix(solc): use correct model for metadata libraries (#1648)

* chore: add spells output

* fix(solc): use correct model for metadata libraries
This commit is contained in:
Matthias Seitz 2022-08-30 19:36:58 +02:00 committed by GitHub
parent 75a8b9066c
commit 13a0144aba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 1 deletions

View File

@ -942,8 +942,11 @@ pub struct MetadataSettings {
#[serde(default, rename = "compilationTarget")] #[serde(default, rename = "compilationTarget")]
pub compilation_target: BTreeMap<String, String>, pub compilation_target: BTreeMap<String, String>,
/// Metadata settings /// Metadata settings
///
/// Note: this differs from `Libraries` and does not require another mapping for file name
/// since metadata is per file
#[serde(default)] #[serde(default)]
pub libraries: Libraries, pub libraries: BTreeMap<String, String>,
} }
/// Compilation source files/source units, keys are file names /// Compilation source files/source units, keys are file names
@ -2135,4 +2138,13 @@ mod tests {
let layout: StorageLayout = serde_json::from_str(input).unwrap(); let layout: StorageLayout = serde_json::from_str(input).unwrap();
pretty_assertions::assert_eq!(input, &serde_json::to_string_pretty(&layout).unwrap()); pretty_assertions::assert_eq!(input, &serde_json::to_string_pretty(&layout).unwrap());
} }
// <https://github.com/foundry-rs/foundry/issues/3012>
#[test]
fn can_parse_compiler_output_spells_0_6_12() {
let path =
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("test-data/0.6.12-with-libs.json");
let content = fs::read_to_string(path).unwrap();
let _output: CompilerOutput = serde_json::from_str(&content).unwrap();
}
} }

File diff suppressed because one or more lines are too long