[pack/unpack] Get the functional tests working again.

There's some hard coded version numbers in the tests, but I'm
leaving for now since I'll rewrite in Rust to avoid too much
of a proliferation of languages.
This commit is contained in:
Joe Thornber
2020-06-09 13:03:39 +01:00
parent db5a71a53c
commit 409a660082
6 changed files with 77 additions and 35 deletions

View File

@@ -2,7 +2,8 @@ extern crate clap;
extern crate thinp;
use clap::{App, Arg};
use std::process;
use std::process::exit;
use thinp::file_utils;
fn main() {
let parser = App::new("thin_metadata_pack")
@@ -25,8 +26,13 @@ fn main() {
let input_file = matches.value_of("INPUT").unwrap();
let output_file = matches.value_of("OUTPUT").unwrap();
if !file_utils::file_exists(input_file) {
eprintln!("Couldn't find input file '{}'.", &input_file);
exit(1);
}
if let Err(reason) = thinp::pack::pack::pack(&input_file, &output_file) {
println!("Application error: {}\n", reason);
process::exit(1);
exit(1);
}
}

View File

@@ -3,6 +3,9 @@ extern crate thinp;
use clap::{App, Arg};
use std::process;
use thinp::file_utils;
use std::process::exit;
fn main() {
let parser = App::new("thin_metadata_unpack")
@@ -21,11 +24,15 @@ fn main() {
.value_name("FILE")
.takes_value(true));
let matches = parser.get_matches();
let input_file = matches.value_of("INPUT").unwrap();
let output_file = matches.value_of("OUTPUT").unwrap();
if !file_utils::file_exists(input_file) {
eprintln!("Couldn't find input file '{}'.", &input_file);
exit(1);
}
if let Err(reason) = thinp::pack::pack::unpack(&input_file, &output_file) {
println!("Application error: {}", reason);
process::exit(1);