moved tests to unit_tests.rs
parent
e6e13c651f
commit
1fd2169a5f
31
src/main.rs
31
src/main.rs
|
@ -1,8 +1,8 @@
|
|||
use clap::{App, load_yaml};
|
||||
use csvcompare::csv_compare::{CsvLine, Params, load_vector, print_lines, write_to_file};
|
||||
use clap::{load_yaml, App};
|
||||
use csvcompare::csv_compare::{load_vector, print_lines, write_to_file, CsvLine, Params};
|
||||
|
||||
use std::fs::File;
|
||||
use std::io::{BufReader};
|
||||
use std::io::BufReader;
|
||||
|
||||
fn main() {
|
||||
let yaml = load_yaml!("cli.yml");
|
||||
|
@ -46,28 +46,3 @@ fn main() {
|
|||
print_lines(diff);
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use std::{fs::File, io::BufReader, path::Path};
|
||||
|
||||
use csvcompare::csv_compare::{CsvLine, load_vector};
|
||||
|
||||
fn get_reader() -> BufReader<File> {
|
||||
let path = Path::new("./assets/csv1.csv");
|
||||
assert_eq!(path.is_file(), true);
|
||||
let file = File::open(path);
|
||||
match file {
|
||||
Ok(_) => BufReader::new(file.unwrap()),
|
||||
Err(_) => panic!("error, could not read file"),
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_load_vector() {
|
||||
let reader = get_reader();
|
||||
let mut vec1: Vec<CsvLine> = Vec::new();
|
||||
load_vector(&mut vec1, reader);
|
||||
assert_eq!(3, vec1.iter().count());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
{"rustc_fingerprint":8779373148605506356,"outputs":{"931469667778813386":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/mace/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\ndebug_assertions\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""},"17598535894874457435":{"success":true,"status":"","code":0,"stdout":"rustc 1.54.0 (a178d0322 2021-07-26)\nbinary: rustc\ncommit-hash: a178d0322ce20e33eac124758e837cbd80a6f633\ncommit-date: 2021-07-26\nhost: x86_64-unknown-linux-gnu\nrelease: 1.54.0\nLLVM version: 12.0.1\n","stderr":""},"2797684049618456168":{"success":false,"status":"exit status: 1","code":1,"stdout":"","stderr":"error: `-Csplit-debuginfo` is unstable on this platform\n\n"}},"successes":{}}
|
||||
{"rustc_fingerprint":8779373148605506356,"outputs":{"17598535894874457435":{"success":true,"status":"","code":0,"stdout":"rustc 1.54.0 (a178d0322 2021-07-26)\nbinary: rustc\ncommit-hash: a178d0322ce20e33eac124758e837cbd80a6f633\ncommit-date: 2021-07-26\nhost: x86_64-unknown-linux-gnu\nrelease: 1.54.0\nLLVM version: 12.0.1\n","stderr":""},"931469667778813386":{"success":true,"status":"","code":0,"stdout":"___\nlib___.rlib\nlib___.so\nlib___.so\nlib___.a\nlib___.so\n/home/mace/.rustup/toolchains/stable-x86_64-unknown-linux-gnu\ndebug_assertions\nproc_macro\ntarget_arch=\"x86_64\"\ntarget_endian=\"little\"\ntarget_env=\"gnu\"\ntarget_family=\"unix\"\ntarget_feature=\"fxsr\"\ntarget_feature=\"sse\"\ntarget_feature=\"sse2\"\ntarget_os=\"linux\"\ntarget_pointer_width=\"64\"\ntarget_vendor=\"unknown\"\nunix\n","stderr":""},"2797684049618456168":{"success":false,"status":"exit status: 1","code":1,"stdout":"","stderr":"error: `-Csplit-debuginfo` is unstable on this platform\n\n"}},"successes":{}}
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
This file has an mtime of when this was started.
|
|
@ -0,0 +1 @@
|
|||
0259ff7e2ed686ea
|
|
@ -0,0 +1 @@
|
|||
{"rustc":17807758859236181817,"features":"[]","target":210469075567098377,"profile":14050059120794533848,"path":1475256587738111628,"deps":[[1107353818263796810,"csvcompare",false,11213782078068079805],[4345520495555234844,"clap",false,14202572740688878169]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/csvcompare-da59e5697c47de3f/dep-test-integration-test-unit_test"}}],"rustflags":[],"metadata":8456049419002105797,"config":0,"compile_kind":0}
|
Binary file not shown.
|
@ -0,0 +1 @@
|
|||
This file has an mtime of when this was started.
|
|
@ -0,0 +1 @@
|
|||
3fb5ced55df0f01f
|
|
@ -0,0 +1 @@
|
|||
{"rustc":17807758859236181817,"features":"[]","target":210469075567098377,"profile":6415348288391478785,"path":1475256587738111628,"deps":[[1107353818263796810,"csvcompare",false,15761132437638236415],[4345520495555234844,"clap",false,8805950514040045324]],"local":[{"CheckDepInfo":{"dep_info":"debug/.fingerprint/csvcompare-e2d56a6023ac531b/dep-test-integration-test-unit_test"}}],"rustflags":[],"metadata":8456049419002105797,"config":0,"compile_kind":0}
|
Binary file not shown.
Binary file not shown.
|
@ -0,0 +1,5 @@
|
|||
/home/mace/repos/rust/csvcompare/target/debug/deps/unit_test-da59e5697c47de3f: tests/unit_test.rs
|
||||
|
||||
/home/mace/repos/rust/csvcompare/target/debug/deps/unit_test-da59e5697c47de3f.d: tests/unit_test.rs
|
||||
|
||||
tests/unit_test.rs:
|
|
@ -0,0 +1,5 @@
|
|||
/home/mace/repos/rust/csvcompare/target/debug/deps/unit_test-e2d56a6023ac531b.rmeta: tests/unit_test.rs
|
||||
|
||||
/home/mace/repos/rust/csvcompare/target/debug/deps/unit_test-e2d56a6023ac531b.d: tests/unit_test.rs
|
||||
|
||||
tests/unit_test.rs:
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue