on master help sign in
Merge branch 'master' of https://github.com/erickt/JSONTestSuite into erickt-master

# Conflicts: # run_tests.py

commit0d88211c35fce7c39aecee728a44ec85268ec62c authorNicolas Seriot <nicolas@seriot.ch> dateWed 26 Oct 2016, 22:09 (10 years ago) parent6961f10cf8b3e3
5 files changed+46
parsers/test_json-rust-serde_json/rj/.gitignore+2 parsers/test_json-rust-serde_json/rj/Cargo.toml+7 parsers/test_json-rust-serde_json/rj/README+2 parsers/test_json-rust-serde_json/rj/src/main.rs+30 run_tests.py+5
parsers/test_json-rust-serde_json/rj/.gitignorenew file+2
@@ -0,0 +1,2 @@
1+Cargo.lock
2+target/
parsers/test_json-rust-serde_json/rj/Cargo.tomlnew file+7
@@ -0,0 +1,7 @@
1+[package]
2+name = "rj"
3+version = "0.1.0"
4+authors = ["Nicolas Seriot <nicolas@seriot.ch>"]
5+
6+[dependencies]
7+serde_json = "*"
parsers/test_json-rust-serde_json/rj/READMEnew file+2
@@ -0,0 +1,2 @@
1+cd /Users/nst/Projects/dropbox/JSON/test_json-rustc_serialize/rj; cargo build ;/Users/nst/Projects/dropbox/JSON/test_json-rustc_serialize/rj/target/debug/rj /Users/nst/Projects/dropbox/JSON/test_cases/n_177.json
2+
parsers/test_json-rust-serde_json/rj/src/main.rsnew file+30
@@ -0,0 +1,30 @@
1+extern crate serde_json;
2+use std::fs::File;
3+use std::io::Read;
4+use std::env;
5+
6+fn main() {
7+ println!("Hello, world!");
8+
9+ let args: Vec<_> = env::args().collect();
10+ if args.len() != 2 {
11+ println!("Usage: {} file.json", args[0]);
12+ std::process::exit(1);
13+ }
14+
15+ let ref path = args[1];
16+ let mut s = String::new();
17+ let mut f = File::open(path).expect("Unable to open file");
18+ //f.read_to_string(&mut s).expect("Unable to read string");
19+ //println!("{}", s);
20+
21+ match f.read_to_string(&mut s) {
22+ Err(_) => std::process::exit(1),
23+ Ok(_) => println!("{}", s),
24+ }
25+
26+ match serde_json::from_str::<serde_json::Value>(&s) {
27+ Ok(_) => std::process::exit(0),
28+ Err(_) => std::process::exit(1)
29+ };
30+}
run_tests.py+5
@@ -182,6 +182,11 @@ programs = {
182182 "url":"https://doc.rust-lang.org/rustc-serialize/rustc_serialize/json/index.html",
183183 "commands":[os.path.join(PARSERS_DIR, "test_json-rustc_serialize/rj/target/debug/rj")]
184184 },
185+ "Rust serde_json":
186+ {
187+ "url":"https://github.com/serde-rs/json",
188+ "commands":[os.path.join(PARSERS_DIR, "test_json-rust-serde_json/rj/target/debug/rj")]
189+ },
185190 "Java json-simple 1.1.1":
186191 {
187192 "url":"",