#[cfg(test)] #[test] fn test1() { use wild_doc::*; let dir = "./wd-test/"; if std::path::Path::new(dir).exists() { std::fs::remove_dir_all(dir).unwrap(); } std::fs::create_dir_all(dir).unwrap(); let mut wd = WildDoc::new(dir, IncludeLocal::new("./include/"), None, 1); let update_xml = br#" admin admin "#; wd.run(update_xml, b"").unwrap(); let r=wd.run(br#" : hoge : : : dep:@ "# ,b"" ).unwrap(); println!("{}", std::str::from_utf8(r.body()).unwrap()); let update_xml = br#""#; wd.run(update_xml, b"").unwrap(); //update data. /*wd.run(r#" Noah US Liam US Olivia UK "#,b"").unwrap();*/ let update_xml = br#" "#; wd.run( update_xml, br#"{ "name":"Noah" ,"from":"US" }"#, ) .unwrap(); wd.run( update_xml, br#"{ "name":"Liam" ,"from":"US" }"#, ) .unwrap(); wd.run( update_xml, br#"{ "name":"Olivia" ,"from":"UK" }"#, ) .unwrap(); //select data. let r=wd.run(br#"
find persons.
"#,b"").unwrap(); println!("{}", std::str::from_utf8(r.body()).unwrap()); //seaech data let r=wd.run(br#"
find persons from the US.
  • : :
"#,b"").unwrap(); println!("{}", std::str::from_utf8(r.body()).unwrap()); //use javascript let r=wd.run(br#"
find persons from the .
  • : :
"#,b"").unwrap(); println!( "{} : {:#?}", std::str::from_utf8(r.body()).unwrap(), r.options() ); //search in update section. let r=wd.run(br#" Renamed "#,b"").unwrap(); println!("{}", std::str::from_utf8(r.body()).unwrap()); let r=wd.run(br#"
find persons.
  • : :
"#,b"").unwrap(); println!("{}", std::str::from_utf8(r.body()).unwrap()); //use WebAPI let r = wd .run( br#" a: input: 2; ?> a: v: "#, br#"{ "name":"Ken" ,"from":"US" }"#, ) .unwrap(); println!( "{} : {:#?}", std::str::from_utf8(r.body()).unwrap(), r.options() ); }