extern crate json;
extern crate retdec;
#[allow(dead_code)]
mod common;
use common::path_to_sample;
use common::run_tool;
#[test]
fn fileinfo_correctly_analyzes_input_file() {
let output = run_tool(
"fileinfo", &[
"--output-format", "json",
"--verbose",
&path_to_sample("pe-hello.exe")
]
);
let stderr = String::from_utf8_lossy(&output.stderr);
assert!(output.status.success(), "fileinfo failed; reason:\n{}", stderr);
assert_eq!(stderr, "");
let stdout = String::from_utf8_lossy(&output.stdout);
let result = json::parse(&stdout)
.expect(&format!("failed to parse the output as JSON:\n {}", stdout));
let file_name = result["inputFile"].as_str()
.expect("failed to get the name of the input file");
assert_eq!(file_name, "pe-hello.exe");
assert!(result["sectionTable"].is_object());
assert!(result["importTable"].is_object());
}