1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#![deny(clippy::all, clippy::pedantic)]
#![deny(warnings, intra_doc_link_resolution_failure)]
#![doc(deny(warnings))]
#[macro_use]
extern crate rust_embed;
use std::env;
use std::fs;
use std::process;
mod mspec;
pub fn main() {
let interp = match mruby::interpreter() {
Ok(interp) => interp,
Err(err) => {
eprintln!("{}", err);
process::exit(1);
}
};
if let Err(err) = mspec::init(&interp) {
eprintln!("{}", err);
process::exit(1);
};
let mut mspec_runner = mspec::Runner::new(interp);
let mut args = env::args();
let mut specs = vec![];
args.next();
for spec in args {
if spec.contains("thread/") || spec.contains("mutex/owned_spec.rb") {
continue;
}
if spec.contains("module/") {
continue;
}
let contents = fs::read(&spec).unwrap();
mspec_runner.add_spec(spec.as_str(), contents).unwrap();
specs.push(spec);
}
match mspec_runner.run() {
Ok(true) => process::exit(0),
Ok(false) => process::exit(1),
Err(err) => {
eprintln!("{}", err);
process::exit(1);
}
}
}