Skip to content

Commit

Permalink
Added tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sphinxc0re committed Dec 2, 2016
1 parent 0c276d9 commit 05581cd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/behaviour/default_response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ mod tests {

let mut entity = Entity::new("TestEntity");

entity.append_behaviour(default_response);
entity.append_behaviour(default_response.clone());

assert_eq!(entity.send_event(Event::Nothing),
Event::Tell(String::from("Responsy!")));
Expand Down
24 changes: 24 additions & 0 deletions src/entity.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,4 +64,28 @@ mod tests {

assert_eq!(res, Event::Tell("Response!".to_owned()));
}

#[test]
fn clone_entity() {
let entity = Entity::new("TestSubject");

let entity_clone = entity.clone();

assert_eq!(entity.name, entity_clone.name);
}

#[test]
fn chained_behaviour() {
let default_response_one = DefaultResponse::new("Response 1!");
let default_response_two = DefaultResponse::new("Response 2!");

let mut entity = Entity::new("TestSubject");

entity.append_behaviour(default_response_one);
entity.append_behaviour(default_response_two);

let res = entity.send_event(Event::Nothing);

assert_eq!(res, Event::Tell("Response 2!".to_owned()));
}
}

0 comments on commit 05581cd

Please sign in to comment.