Skip to content

Commit 3893d65

Browse files
add test_bif_exit_301_parse_url
1 parent 9e5019c commit 3893d65

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/bif/parse_bif_exit_tests.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -340,4 +340,25 @@ mod tests {
340340
assert!(template.has_error());
341341
assert_eq!(template.get_status_code(), "200");
342342
}
343+
344+
#[test]
345+
fn test_bif_exit_301_parse_url() {
346+
let mut template = match crate::Template::new() {
347+
Ok(tpl) => tpl,
348+
Err(error) => {
349+
println!("Error creating Template: {}", error);
350+
assert!(false);
351+
return;
352+
}
353+
};
354+
template.merge_schema_str(SCHEMA).unwrap();
355+
template.set_src_str("<div>{:exit; 301 >> /home?{:;__test-nts:} :}</div>");
356+
let result = template.render();
357+
assert!(!template.has_error());
358+
assert_eq!(template.get_status_code(), "301");
359+
assert_eq!(template.get_status_text(), "Moved Permanently");
360+
assert_eq!(template.get_status_param(), "/home?nts");
361+
assert_eq!(result, "301 Moved Permanently\n/home?nts");
362+
}
363+
343364
}

0 commit comments

Comments
 (0)