Bubble up the error to main instead of panicking
This commit is contained in:
@ -1,4 +1,28 @@
|
||||
use tradaf::*;
|
||||
/*
|
||||
use std::{
|
||||
format,
|
||||
fs::{read_dir, read_to_string},
|
||||
};
|
||||
|
||||
use expect_test::{expect, Expect};
|
||||
|
||||
fn check(input: &str, expected: Expect) {}
|
||||
|
||||
#[test]
|
||||
fn smoke() {
|
||||
check("", "");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_all() {
|
||||
for file in read_dir("./test_data/in") {
|
||||
let input = read_to_string(&format!("./test_data/in/{}", file));
|
||||
let output = read_to_string(&format!("./test_data/out/{}", file));
|
||||
check(input, output)
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
fn example_to_vec(file: &str) -> Vec<u8> {
|
||||
use std::fs::File;
|
||||
@ -25,13 +49,13 @@ fn ron_to_json() {
|
||||
format_out: None,
|
||||
|
||||
pretty: true,
|
||||
no_newline: false,
|
||||
no_extra_line: false,
|
||||
};
|
||||
|
||||
let input = example_to_vec("test-data/materials.ron");
|
||||
|
||||
let mut output = vec![];
|
||||
transcode(opt, &mut input.as_slice(), &mut output);
|
||||
transcode(opt, &mut input.as_slice(), &mut output).unwrap();
|
||||
let out = String::from_utf8(output).unwrap();
|
||||
|
||||
let control = example_to_string("test-data/materials.json");
|
||||
@ -49,13 +73,13 @@ fn json5_read_json() {
|
||||
format_out: None,
|
||||
|
||||
pretty: true,
|
||||
no_newline: false,
|
||||
no_extra_line: false,
|
||||
};
|
||||
|
||||
let input = example_to_vec("test-data/materials.json");
|
||||
|
||||
let mut output = vec![];
|
||||
transcode(opt, &mut input.as_slice(), &mut output);
|
||||
transcode(opt, &mut input.as_slice(), &mut output).unwrap();
|
||||
let out = String::from_utf8(output).unwrap();
|
||||
|
||||
let control = example_to_string("test-data/materials.json");
|
||||
|
Reference in New Issue
Block a user