aboutsummaryrefslogtreecommitdiff
path: root/src/tokenizer
diff options
context:
space:
mode:
Diffstat (limited to 'src/tokenizer')
-rw-r--r--src/tokenizer/mod.rs24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/tokenizer/mod.rs b/src/tokenizer/mod.rs
index 0a0f7af..2d5e1ed 100644
--- a/src/tokenizer/mod.rs
+++ b/src/tokenizer/mod.rs
@@ -2267,15 +2267,19 @@ mod test {
assert_eq!(s, Some("yx".into()));
}
- #[test]
- fn check_lines() {
- let opts = TokenizerOpts {
+ fn opts() -> TokenizerOpts {
+ TokenizerOpts {
exact_errors: false,
discard_bom: true,
profile: false,
initial_state: None,
last_start_tag_name: None,
- };
+ }
+ }
+
+ #[test]
+ fn check_lines() {
+ let opts = opts();
let vector = vec![
String::from("<a>\n"),
String::from("<b>\n"),
@@ -2304,13 +2308,7 @@ mod test {
#[test]
fn check_lines_with_new_line() {
- let opts = TokenizerOpts {
- exact_errors: false,
- discard_bom: true,
- profile: false,
- initial_state: None,
- last_start_tag_name: None,
- };
+ let opts = opts();
let vector = vec![
String::from("<a>\r\n"),
String::from("<b>\r\n"),
@@ -2340,7 +2338,7 @@ mod test {
#[test]
#[cfg(not(feature = "named-entities"))]
fn named_entities() {
- let opts = TokenizerOpts::default();
+ let opts = opts();
let vector = vec![String::from("&amp;\r\n"), String::from("&aamp;\r\n")];
let expected = vec![(3, Token::CharacterTokens("&amp;\n&aamp;\n".into()))];
let results = tokenize(vector, opts);
@@ -2350,7 +2348,7 @@ mod test {
#[test]
#[cfg(feature = "named-entities")]
fn named_entities() {
- let opts = TokenizerOpts::default();
+ let opts = opts();
let vector = vec![String::from("&amp;\r\n"), String::from("&aamp;\r\n")];
let expected = vec![
(3, CharacterTokens("&\n".into())),