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
extern crate rustc_serialize; #[macro_use] extern crate hyper; extern crate futures; extern crate tokio_core; pub mod libhoney; pub mod event; pub mod builder; pub mod builder_trait; pub mod transmission_trait; mod transmission; #[cfg(test)] mod tests { use event::Event; use libhoney::Libhoney; use builder_trait::BuilderT; use transmission_trait::TransmissionT; use rustc_serialize::json::{ToJson}; /* pub struct MockTransmission { EventJson: String } impl TransmissionT for MockTransmission { fn send_formatted_event(&mut self, formatted_event: &Json) { self.EventJson = formatted_event.to_string() } } impl MockTransmission { fn new() -> MockTransmission { return MockTransmission{ EventJson: "".to_string() } } } #[test] fn it_works() { let mut mock_transition = MockTransmission::new(); let mut hny = Libhoney::new_with_transmission(mock_transition); hny.add_field("key".to_string(), "value".to_json()); hny.add_field("key2".to_string(), "value2".to_json()); let ev = hny.new_event(); assert_eq!("{\"key\":\"value\",\"key2\":\"value2\"}", ev.to_json().to_string()); } */ }