aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Fischer <martin@push-f.com>2021-11-29 19:26:36 +0100
committerMartin Fischer <martin@push-f.com>2021-11-30 11:22:35 +0100
commit2ac9a1fe35c03358de502db85c0b4633f072a90e (patch)
treee097818a681015864fbf5c4e0e7ac40588d6f2a6
parent8b6e4ba30354d466b56bf80f1bb58c371cfdf7c9 (diff)
refactor: make tests independent of TokenizerOpts::default()
-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())),