Skip to content

Commit

Permalink
test: Added template info test
Browse files Browse the repository at this point in the history
  • Loading branch information
mitsuhiko committed Mar 25, 2018
1 parent 53672f0 commit 1581f1b
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions tests/test_protocol_v7.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,33 @@ fn test_stacktrace() {
);
}

#[test]
fn test_template_info() {
let event = v7::Event {
template_info: Some(v7::TemplateInfo {
location: v7::FileLocation {
filename: Some("hello.html".into()),
line: Some(1),
..Default::default()
},
source: v7::EmbeddedSources {
pre_lines: vec!["foo1".into(), "bar2".into()],
current_line: Some("hey hey hey3".into()),
post_lines: vec!["foo4".into(), "bar5".into()],
},
}),
..Default::default()
};

assert_roundtrip(&event);
assert_eq!(
serde_json::to_string(&event).unwrap(),
"{\"template\":{\"filename\":\"hello.html\",\"lineno\":1,\
\"pre_context\":[\"foo1\",\"bar2\"],\"context_line\":\
\"hey hey hey3\",\"post_context\":[\"foo4\",\"bar5\"]}}"
);
}

#[test]
fn test_request() {
let event = v7::Event {
Expand Down

0 comments on commit 1581f1b

Please sign in to comment.