Rename init to new to be more conventionnal.

This commit is contained in:
jcamiel 2022-08-17 09:24:30 +02:00
parent 97835c3a17
commit 6fc568a6f0
No known key found for this signature in database
GPG Key ID: 07FF11CFD55356CC
34 changed files with 467 additions and 467 deletions

View File

@ -138,7 +138,7 @@ HTTP/1.0 200
captures: vec![],
asserts: vec![],
errors: vec![Error {
source_info: SourceInfo::init(2, 10, 2, 13),
source_info: SourceInfo::new(2, 10, 2, 13),
inner: RunnerError::AssertStatus {
actual: "404".to_string(),
},
@ -177,7 +177,7 @@ HTTP/1.0 200
captures: vec![],
asserts: vec![],
errors: vec![Error {
source_info: SourceInfo::init(1, 5, 1, 19),
source_info: SourceInfo::new(1, 5, 1, 19),
inner: RunnerError::HttpConnection {
url: "http://unknown".to_string(),
message: "(6) Could not resolve host: unknown".to_string(),

View File

@ -167,13 +167,13 @@ pub mod tests {
pub fn assert_count_user() -> Assert {
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
};
let predicate = Predicate {
not: false,
space0: whitespace.clone(),
predicate_func: PredicateFunc {
source_info: SourceInfo::init(1, 14, 1, 27),
source_info: SourceInfo::new(1, 14, 1, 27),
value: PredicateFuncValue::CountEqual {
space0: whitespace.clone(),
value: PredicateValue::Integer(3),
@ -208,7 +208,7 @@ pub mod tests {
),
AssertResult::Explicit {
actual: Ok(Some(Value::Nodeset(3))),
source_info: SourceInfo::init(1, 14, 1, 27),
source_info: SourceInfo::new(1, 14, 1, 27),
predicate_result: Some(Ok(())),
}
);

View File

@ -97,14 +97,14 @@ mod tests {
// file, data.bin;
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
let bytes = Bytes::File(File {
space0: whitespace.clone(),
filename: Filename {
value: String::from("tests/data.bin"),
source_info: SourceInfo::init(1, 7, 1, 15),
source_info: SourceInfo::new(1, 7, 1, 15),
},
space1: whitespace,
});
@ -124,14 +124,14 @@ mod tests {
// file, data.bin;
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
let bytes = Bytes::File(File {
space0: whitespace.clone(),
filename: Filename {
value: String::from("data.bin"),
source_info: SourceInfo::init(1, 7, 1, 15),
source_info: SourceInfo::new(1, 7, 1, 15),
},
space1: whitespace,
});
@ -148,6 +148,6 @@ mod tests {
value: "data.bin".to_string()
}
);
assert_eq!(error.source_info, SourceInfo::init(1, 7, 1, 15));
assert_eq!(error.source_info, SourceInfo::new(1, 7, 1, 15));
}
}

View File

@ -58,7 +58,7 @@ pub mod tests {
// non scalar value
let whitespace = Whitespace {
value: String::from(""),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
Capture {
line_terminators: vec![],
@ -67,7 +67,7 @@ pub mod tests {
quotes: false,
value: "UserCount".to_string(),
encoded: "UserCount".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space1: whitespace.clone(),
space2: whitespace.clone(),
@ -86,7 +86,7 @@ pub mod tests {
// non scalar value
let whitespace = Whitespace {
value: String::from(""),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
Capture {
line_terminators: vec![],
@ -95,7 +95,7 @@ pub mod tests {
quotes: false,
value: "duration".to_string(),
encoded: "duration".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space1: whitespace.clone(),
space2: whitespace.clone(),
@ -115,7 +115,7 @@ pub mod tests {
let variables = HashMap::new();
let whitespace = Whitespace {
value: String::from(""),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
let capture = Capture {
line_terminators: vec![],
@ -124,7 +124,7 @@ pub mod tests {
quotes: false,
value: "count".to_string(),
encoded: "count".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space1: whitespace.clone(),
space2: whitespace.clone(),
@ -149,7 +149,7 @@ pub mod tests {
// non scalar value
let whitespace = Whitespace {
value: String::from(""),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
let _capture = Capture {
line_terminators: vec![],
@ -158,14 +158,14 @@ pub mod tests {
quotes: false,
value: "???".to_string(),
encoded: "???".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space1: whitespace.clone(),
space2: whitespace.clone(),
// xpath //user
query: Query {
source_info: SourceInfo::init(1, 1, 1, 13),
source_info: SourceInfo::new(1, 1, 1, 13),
value: QueryValue::Xpath {
space0: whitespace.clone(),
expr: Template {
@ -174,7 +174,7 @@ pub mod tests {
value: "//user".to_string(),
encoded: "//user".to_string(),
}],
source_info: SourceInfo::init(1, 7, 1, 13),
source_info: SourceInfo::new(1, 7, 1, 13),
},
},

View File

@ -174,15 +174,15 @@ mod tests {
TemplateElement::Expression(Expr {
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 15, 1, 15),
source_info: SourceInfo::new(1, 15, 1, 15),
},
variable: Variable {
name: "name".to_string(),
source_info: SourceInfo::init(1, 15, 1, 19),
source_info: SourceInfo::new(1, 15, 1, 19),
},
space1: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 19, 1, 19),
source_info: SourceInfo::new(1, 19, 1, 19),
},
}),
TemplateElement::String {
@ -190,7 +190,7 @@ mod tests {
encoded: "!".to_string(),
},
],
source_info: SourceInfo::init(1, 2, 1, 22),
source_info: SourceInfo::new(1, 2, 1, 22),
})
}
@ -205,7 +205,7 @@ mod tests {
value: "firstName".to_string(),
encoded: "firstName".to_string(),
}],
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
},
space1: "".to_string(),
space2: " ".to_string(),
@ -215,7 +215,7 @@ mod tests {
value: "John".to_string(),
encoded: "John".to_string(),
}],
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
}),
space3: "\n".to_string(),
}],
@ -250,7 +250,7 @@ mod tests {
let error = eval_json_value(&json_hello_world_value(), &variables)
.err()
.unwrap();
assert_eq!(error.source_info, SourceInfo::init(1, 15, 1, 19));
assert_eq!(error.source_info, SourceInfo::new(1, 15, 1, 19));
assert_eq!(
error.inner,
RunnerError::TemplateVariableNotDefined {
@ -309,7 +309,7 @@ mod tests {
encoded: "Hi".to_string(),
value: "Hi".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
assert_eq!(
eval_json_value(
@ -369,7 +369,7 @@ mod tests {
value: "\n".to_string(),
encoded: "\\n".to_string(),
}],
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
}),
&variables,
)
@ -389,7 +389,7 @@ mod tests {
value: "\n".to_string(),
encoded: "\\n".to_string(),
}],
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
},
&variables,
)
@ -412,12 +412,12 @@ mod tests {
space0: whitespace(),
variable: Variable {
name: "quote".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space1: whitespace(),
}),
],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
&variables,
)
@ -429,7 +429,7 @@ mod tests {
fn whitespace() -> Whitespace {
Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}
}

View File

@ -95,7 +95,7 @@ mod tests {
pub fn whitespace() -> Whitespace {
Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}
}
@ -117,7 +117,7 @@ mod tests {
value: "upload1".to_string(),
encoded: "upload1".to_string(),
quotes: false,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space1: whitespace(),
space2: whitespace(),
@ -125,7 +125,7 @@ mod tests {
space0: whitespace(),
filename: Filename {
value: "hello.txt".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space1: whitespace(),
space2: whitespace(),
@ -154,7 +154,7 @@ mod tests {
space0: whitespace(),
filename: Filename {
value: "hello.txt".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space1: whitespace(),
space2: whitespace(),
@ -168,7 +168,7 @@ mod tests {
space0: whitespace(),
filename: Filename {
value: "hello.html".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space1: whitespace(),
space2: whitespace(),
@ -182,7 +182,7 @@ mod tests {
space0: whitespace(),
filename: Filename {
value: "hello.txt".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space1: whitespace(),
space2: whitespace(),
@ -196,7 +196,7 @@ mod tests {
space0: whitespace(),
filename: Filename {
value: "hello".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space1: whitespace(),
space2: whitespace(),

View File

@ -804,7 +804,7 @@ mod tests {
fn whitespace() -> Whitespace {
Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}
}
@ -827,7 +827,7 @@ mod tests {
let variables = HashMap::new();
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 1, 0, 0),
source_info: SourceInfo::new(1, 1, 0, 0),
};
let predicate = Predicate {
@ -839,7 +839,7 @@ mod tests {
value: PredicateValue::Integer(10),
operator: false,
},
source_info: SourceInfo::init(1, 11, 1, 12),
source_info: SourceInfo::new(1, 11, 1, 12),
},
};
@ -856,7 +856,7 @@ mod tests {
type_mismatch: false,
}
);
assert_eq!(error.source_info, SourceInfo::init(1, 0, 1, 0));
assert_eq!(error.source_info, SourceInfo::new(1, 0, 1, 0));
assert!(eval_predicate(predicate, &variables, Some(Value::Integer(1))).is_ok());
}
@ -866,7 +866,7 @@ mod tests {
let variables = HashMap::new();
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
let assert_result = eval_predicate_func(
PredicateFunc {
@ -875,7 +875,7 @@ mod tests {
value: PredicateValue::Integer(10),
operator: false,
},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
&variables,
Some(Value::Bool(true)),
@ -892,7 +892,7 @@ mod tests {
let variables = HashMap::new();
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
let assert_result = eval_predicate_func(
PredicateFunc {
@ -901,7 +901,7 @@ mod tests {
value: PredicateValue::Integer(10),
operator: false,
},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
&variables,
Some(Value::Unit),
@ -918,7 +918,7 @@ mod tests {
let variables = HashMap::new();
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
let assert_result = eval_something(
@ -928,7 +928,7 @@ mod tests {
value: PredicateValue::Integer(10),
operator: false,
},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
&variables,
Value::Integer(1),
@ -946,7 +946,7 @@ mod tests {
value: PredicateValue::Bool(true),
operator: false,
},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
&variables,
Value::Bool(false),
@ -967,7 +967,7 @@ mod tests {
}),
operator: false,
},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
&variables,
Value::Float(1.1),
@ -984,7 +984,7 @@ mod tests {
let variables = HashMap::new();
let predicate_func = PredicateFunc {
value: PredicateFuncValue::Exist {},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
let assert_result =
@ -1004,7 +1004,7 @@ mod tests {
let variables = HashMap::new();
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
let assert_result = eval_something(
PredicateFunc {
@ -1013,7 +1013,7 @@ mod tests {
value: PredicateValue::Integer(1),
operator: false,
},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
&variables,
Value::Integer(1),
@ -1030,7 +1030,7 @@ mod tests {
let variables = HashMap::new();
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
let assert_result = eval_something(
PredicateFunc {
@ -1039,7 +1039,7 @@ mod tests {
value: PredicateValue::Bool(false),
operator: false,
},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
&variables,
Value::Bool(false),
@ -1056,7 +1056,7 @@ mod tests {
let variables = HashMap::new();
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
let assert_result = eval_something(
PredicateFunc {
@ -1068,7 +1068,7 @@ mod tests {
}),
operator: false,
},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
&variables,
Value::Float(1.1),
@ -1085,7 +1085,7 @@ mod tests {
let variables = HashMap::new();
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
// a float can be equals to an int (but the reverse)
let assert_result = eval_something(
@ -1095,7 +1095,7 @@ mod tests {
value: PredicateValue::Integer(1),
operator: false,
},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
&variables,
Value::Float(1.0),
@ -1112,7 +1112,7 @@ mod tests {
let variables = HashMap::new();
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
let assert_result = eval_something(
PredicateFunc {
@ -1121,7 +1121,7 @@ mod tests {
value: PredicateValue::Integer(1),
operator: false,
},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
&variables,
Value::Integer(2),
@ -1138,7 +1138,7 @@ mod tests {
let mut variables = HashMap::new();
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
let template = Template {
@ -1146,18 +1146,18 @@ mod tests {
elements: vec![TemplateElement::Expression(Expr {
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 11, 1, 11),
source_info: SourceInfo::new(1, 11, 1, 11),
},
variable: Variable {
name: String::from("base_url"),
source_info: SourceInfo::init(1, 11, 1, 19),
source_info: SourceInfo::new(1, 11, 1, 19),
},
space1: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 19, 1, 19),
source_info: SourceInfo::new(1, 19, 1, 19),
},
})],
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
};
let error = eval_something(
@ -1167,7 +1167,7 @@ mod tests {
value: PredicateValue::String(template.clone()),
operator: false,
},
source_info: SourceInfo::init(1, 1, 1, 21),
source_info: SourceInfo::new(1, 1, 1, 21),
},
&variables,
Value::String(String::from("http://localhost:8000")),
@ -1180,7 +1180,7 @@ mod tests {
name: String::from("base_url")
}
);
assert_eq!(error.source_info, SourceInfo::init(1, 11, 1, 19));
assert_eq!(error.source_info, SourceInfo::new(1, 11, 1, 19));
variables.insert(
String::from("base_url"),
@ -1193,7 +1193,7 @@ mod tests {
value: PredicateValue::String(template),
operator: false,
},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
&variables,
Value::String(String::from("http://localhost:8000")),
@ -1336,7 +1336,7 @@ mod tests {
let variables = HashMap::new();
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
let assert_result = eval_something(
@ -1345,7 +1345,7 @@ mod tests {
space0: whitespace.clone(),
value: PredicateValue::Integer(10),
},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
&variables,
Value::Bool(true),
@ -1362,7 +1362,7 @@ mod tests {
space0: whitespace.clone(),
value: PredicateValue::Integer(1),
},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
&variables,
Value::List(vec![]),
@ -1375,7 +1375,7 @@ mod tests {
let assert_result = eval_something(
PredicateFunc {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: PredicateFuncValue::CountEqual {
space0: whitespace,
value: PredicateValue::Integer(1),
@ -1396,7 +1396,7 @@ mod tests {
let variables = HashMap::new();
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
let assert_result = eval_something(
PredicateFunc {
@ -1404,7 +1404,7 @@ mod tests {
space0: whitespace.clone(),
value: PredicateValue::Integer(1),
},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
&variables,
Value::List(vec![Value::Integer(1)]),
@ -1421,7 +1421,7 @@ mod tests {
space0: whitespace,
value: PredicateValue::Integer(1),
},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
&variables,
Value::Nodeset(1),
@ -1439,7 +1439,7 @@ mod tests {
let assert_result = eval_something(
PredicateFunc {
value: PredicateFuncValue::IsInteger {},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
&variables,
Value::Integer(1),
@ -1453,7 +1453,7 @@ mod tests {
let assert_result = eval_something(
PredicateFunc {
value: PredicateFuncValue::IsInteger {},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
&variables,
Value::Float(1.0),
@ -1472,7 +1472,7 @@ mod tests {
not: true,
space0: whitespace(),
predicate_func: PredicateFunc {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: PredicateFuncValue::Equal {
space0: whitespace(),
operator: false,
@ -1490,7 +1490,7 @@ mod tests {
not: true,
space0: whitespace(),
predicate_func: PredicateFunc {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: PredicateFuncValue::StartWith {
space0: whitespace(),
value: PredicateValue::String(Template {
@ -1499,7 +1499,7 @@ mod tests {
value: "toto".to_string(),
encoded: "toto".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}),
},
},
@ -1523,7 +1523,7 @@ mod tests {
not: false,
space0: whitespace(),
predicate_func: PredicateFunc {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: PredicateFuncValue::Equal {
space0: whitespace(),
value: PredicateValue::Null {},
@ -1547,7 +1547,7 @@ mod tests {
not: true,
space0: whitespace(),
predicate_func: PredicateFunc {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: PredicateFuncValue::Equal {
space0: whitespace(),
operator: false,
@ -1565,7 +1565,7 @@ mod tests {
let variables = HashMap::new();
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
// // a float can be equals to an int (but the reverse)
let assert_result = eval_something(
@ -1576,7 +1576,7 @@ mod tests {
inner: regex::Regex::new(r#"a{3}"#).unwrap(),
}),
},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
&variables,
Value::String("aa".to_string()),

View File

@ -339,10 +339,10 @@ pub mod tests {
// xpath ???
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
Query {
source_info: SourceInfo::init(1, 1, 1, 13),
source_info: SourceInfo::new(1, 1, 1, 13),
value: QueryValue::Xpath {
space0: whitespace,
expr: Template {
@ -351,7 +351,7 @@ pub mod tests {
value: "???".to_string(),
encoded: "???".to_string(),
}],
source_info: SourceInfo::init(1, 7, 1, 10),
source_info: SourceInfo::new(1, 7, 1, 10),
},
},
subquery: None,
@ -361,10 +361,10 @@ pub mod tests {
pub fn xpath_count_user_query() -> Query {
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
Query {
source_info: SourceInfo::init(1, 1, 1, 13),
source_info: SourceInfo::new(1, 1, 1, 13),
value: QueryValue::Xpath {
space0: whitespace,
expr: Template {
@ -373,7 +373,7 @@ pub mod tests {
value: "count(//user)".to_string(),
encoded: "count(//user)".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
},
subquery: None,
@ -383,10 +383,10 @@ pub mod tests {
pub fn xpath_users() -> Query {
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
Query {
source_info: SourceInfo::init(1, 1, 1, 13),
source_info: SourceInfo::new(1, 1, 1, 13),
value: QueryValue::Xpath {
space0: whitespace,
expr: Template {
@ -395,7 +395,7 @@ pub mod tests {
value: "//user".to_string(),
encoded: "/user".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
},
subquery: None,
@ -426,11 +426,11 @@ pub mod tests {
pub fn jsonpath_success() -> Query {
// jsonpath $.success
Query {
source_info: SourceInfo::init(1, 1, 1, 19),
source_info: SourceInfo::new(1, 1, 1, 19),
value: QueryValue::Jsonpath {
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 9, 1, 10),
source_info: SourceInfo::new(1, 9, 1, 10),
},
expr: Template {
elements: vec![TemplateElement::String {
@ -439,7 +439,7 @@ pub mod tests {
}],
quotes: true,
//delimiter: "".to_string(),
source_info: SourceInfo::init(1, 10, 1, 19),
source_info: SourceInfo::new(1, 10, 1, 19),
},
},
subquery: None,
@ -449,11 +449,11 @@ pub mod tests {
pub fn jsonpath_errors() -> Query {
// jsonpath $.errors
Query {
source_info: SourceInfo::init(1, 1, 1, 19),
source_info: SourceInfo::new(1, 1, 1, 19),
value: QueryValue::Jsonpath {
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 9, 1, 10),
source_info: SourceInfo::new(1, 9, 1, 10),
},
expr: Template {
elements: vec![TemplateElement::String {
@ -462,7 +462,7 @@ pub mod tests {
}],
quotes: true,
// delimiter: "".to_string(),
source_info: SourceInfo::init(1, 10, 1, 18),
source_info: SourceInfo::new(1, 10, 1, 18),
},
},
subquery: None,
@ -472,11 +472,11 @@ pub mod tests {
pub fn jsonpath_errors_count() -> Query {
// jsonpath "$.errors" count
Query {
source_info: SourceInfo::init(1, 1, 1, 19),
source_info: SourceInfo::new(1, 1, 1, 19),
value: QueryValue::Jsonpath {
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 9, 1, 10),
source_info: SourceInfo::new(1, 9, 1, 10),
},
expr: Template {
elements: vec![TemplateElement::String {
@ -485,16 +485,16 @@ pub mod tests {
}],
quotes: true,
// delimiter: "".to_string(),
source_info: SourceInfo::init(1, 10, 1, 18),
source_info: SourceInfo::new(1, 10, 1, 18),
},
},
subquery: Some((
Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
Subquery {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: SubqueryValue::Count {},
},
)),
@ -504,11 +504,11 @@ pub mod tests {
pub fn jsonpath_duration() -> Query {
// jsonpath $.errors
Query {
source_info: SourceInfo::init(1, 1, 1, 19),
source_info: SourceInfo::new(1, 1, 1, 19),
value: QueryValue::Jsonpath {
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 9, 1, 10),
source_info: SourceInfo::new(1, 9, 1, 10),
},
expr: Template {
elements: vec![TemplateElement::String {
@ -517,7 +517,7 @@ pub mod tests {
}],
quotes: true,
// delimiter: "".to_string(),
source_info: SourceInfo::init(1, 10, 1, 18),
source_info: SourceInfo::new(1, 10, 1, 18),
},
},
subquery: None,
@ -527,11 +527,11 @@ pub mod tests {
pub fn regex_name() -> Query {
// regex "Hello ([a-zA-Z]+)!"
Query {
source_info: SourceInfo::init(1, 1, 1, 26),
source_info: SourceInfo::new(1, 1, 1, 26),
value: QueryValue::Regex {
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 6, 1, 7),
source_info: SourceInfo::new(1, 6, 1, 7),
},
value: RegexValue::Template(Template {
quotes: true,
@ -539,7 +539,7 @@ pub mod tests {
value: "Hello ([a-zA-Z]+)!".to_string(),
encoded: "Hello ([a-zA-Z]+)!".to_string(),
}],
source_info: SourceInfo::init(1, 7, 1, 26),
source_info: SourceInfo::new(1, 7, 1, 26),
}),
},
subquery: None,
@ -549,11 +549,11 @@ pub mod tests {
pub fn regex_invalid() -> Query {
// regex ???"
Query {
source_info: SourceInfo::init(1, 1, 1, 26),
source_info: SourceInfo::new(1, 1, 1, 26),
value: QueryValue::Regex {
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 6, 1, 7),
source_info: SourceInfo::new(1, 6, 1, 7),
},
value: RegexValue::Template(Template {
quotes: true,
@ -561,7 +561,7 @@ pub mod tests {
value: "???".to_string(),
encoded: "???".to_string(),
}],
source_info: SourceInfo::init(1, 7, 1, 10),
source_info: SourceInfo::new(1, 7, 1, 10),
}),
},
subquery: None,
@ -574,7 +574,7 @@ pub mod tests {
assert_eq!(
eval_query(
Query {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: QueryValue::Status {},
subquery: None
},
@ -592,11 +592,11 @@ pub mod tests {
let variables = HashMap::new();
// header Custom
let query_header = Query {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: QueryValue::Header {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 7, 1, 8),
source_info: SourceInfo::new(1, 7, 1, 8),
},
name: Template {
quotes: true,
@ -604,7 +604,7 @@ pub mod tests {
value: "Custom".to_string(),
encoded: "Custom".to_string(),
}],
source_info: SourceInfo::init(2, 8, 2, 14),
source_info: SourceInfo::new(2, 8, 2, 14),
},
},
subquery: None,
@ -623,11 +623,11 @@ pub mod tests {
// header Content-Type
let variables = HashMap::new();
let query_header = Query {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: QueryValue::Header {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 7, 1, 8),
source_info: SourceInfo::new(1, 7, 1, 8),
},
name: Template {
quotes: true,
@ -635,7 +635,7 @@ pub mod tests {
value: "Content-Type".to_string(),
encoded: "Content-Type".to_string(),
}],
source_info: SourceInfo::init(1, 8, 1, 16),
source_info: SourceInfo::new(1, 8, 1, 16),
},
},
subquery: None,
@ -653,7 +653,7 @@ pub mod tests {
let variables = HashMap::new();
let space = Whitespace {
value: String::from(""),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
let response = http::Response {
version: http::Version::Http10,
@ -670,7 +670,7 @@ pub mod tests {
// cookie "LSID"
let query = Query {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: QueryValue::Cookie {
space0: space.clone(),
expr: CookiePath {
@ -680,7 +680,7 @@ pub mod tests {
value: "LSID".to_string(),
encoded: "LSID".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
attribute: None,
},
@ -696,7 +696,7 @@ pub mod tests {
// cookie "LSID[Path]"
let query = Query {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: QueryValue::Cookie {
space0: space.clone(),
expr: CookiePath {
@ -706,7 +706,7 @@ pub mod tests {
value: "LSID".to_string(),
encoded: "LSID".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
attribute: Some(CookieAttribute {
space0: space.clone(),
@ -726,7 +726,7 @@ pub mod tests {
// cookie "LSID[Secure]"
let query = Query {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: QueryValue::Cookie {
space0: space.clone(),
expr: CookiePath {
@ -736,7 +736,7 @@ pub mod tests {
value: "LSID".to_string(),
encoded: "LSID".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
attribute: Some(CookieAttribute {
space0: space.clone(),
@ -756,7 +756,7 @@ pub mod tests {
// cookie "LSID[Domain]"
let query = Query {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: QueryValue::Cookie {
space0: space.clone(),
expr: CookiePath {
@ -766,7 +766,7 @@ pub mod tests {
value: "LSID".to_string(),
encoded: "LSID".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
attribute: Some(CookieAttribute {
space0: space.clone(),
@ -864,7 +864,7 @@ pub mod tests {
assert_eq!(
eval_query(
Query {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: QueryValue::Body {},
subquery: None
},
@ -877,7 +877,7 @@ pub mod tests {
);
let error = eval_query(
Query {
source_info: SourceInfo::init(1, 1, 1, 2),
source_info: SourceInfo::new(1, 1, 1, 2),
value: QueryValue::Body {},
subquery: None,
},
@ -886,7 +886,7 @@ pub mod tests {
)
.err()
.unwrap();
assert_eq!(error.source_info, SourceInfo::init(1, 1, 1, 2));
assert_eq!(error.source_info, SourceInfo::new(1, 1, 1, 2));
assert_eq!(
error.inner,
RunnerError::InvalidDecoding {
@ -922,11 +922,11 @@ pub mod tests {
let variables = HashMap::new();
// xpath ^^^
let query = Query {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: QueryValue::Xpath {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 6, 1, 7),
source_info: SourceInfo::new(1, 6, 1, 7),
},
expr: Template {
quotes: true,
@ -934,7 +934,7 @@ pub mod tests {
value: "^^^".to_string(),
encoded: "^^^".to_string(),
}],
source_info: SourceInfo::init(1, 7, 1, 10),
source_info: SourceInfo::new(1, 7, 1, 10),
},
},
subquery: None,
@ -977,10 +977,10 @@ pub mod tests {
// $x("normalize-space(/html/head/meta/@charset)")
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
Query {
source_info: SourceInfo::init(1, 1, 1, 13),
source_info: SourceInfo::new(1, 1, 1, 13),
value: QueryValue::Xpath {
space0: whitespace,
expr: Template {
@ -989,7 +989,7 @@ pub mod tests {
value: "normalize-space(/html/head/meta/@charset)".to_string(),
encoded: "normalize-space(/html/head/meta/@charset)".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
},
subquery: None,
@ -1013,11 +1013,11 @@ pub mod tests {
// jsonpath xxx
let jsonpath_query = Query {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: QueryValue::Jsonpath {
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 9, 1, 10),
source_info: SourceInfo::new(1, 9, 1, 10),
},
expr: Template {
elements: vec![TemplateElement::String {
@ -1026,7 +1026,7 @@ pub mod tests {
}],
quotes: true,
// delimiter: "".to_string(),
source_info: SourceInfo::init(1, 10, 1, 13),
source_info: SourceInfo::new(1, 10, 1, 13),
},
},
subquery: None,
@ -1130,7 +1130,7 @@ pub mod tests {
let error = eval_query(regex_invalid(), &variables, http::hello_http_response())
.err()
.unwrap();
assert_eq!(error.source_info, SourceInfo::init(1, 7, 1, 10));
assert_eq!(error.source_info, SourceInfo::new(1, 7, 1, 10));
assert_eq!(error.inner, RunnerError::InvalidRegex());
}
@ -1140,7 +1140,7 @@ pub mod tests {
assert_eq!(
eval_query(
Query {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: QueryValue::Bytes {},
subquery: None
},
@ -1159,7 +1159,7 @@ pub mod tests {
assert_eq!(
eval_query(
Query {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: QueryValue::Sha256 {},
subquery: None
},

View File

@ -188,7 +188,7 @@ mod tests {
pub fn whitespace() -> Whitespace {
Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}
}
@ -209,7 +209,7 @@ mod tests {
space0: whitespace(),
variable: Variable {
name: String::from("base_url"),
source_info: SourceInfo::init(1, 7, 1, 15),
source_info: SourceInfo::new(1, 7, 1, 15),
},
space1: whitespace(),
}),
@ -219,13 +219,13 @@ mod tests {
},
],
quotes: false,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
line_terminator0: line_terminator,
headers: vec![],
sections: vec![],
body: None,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}
}
@ -263,7 +263,7 @@ mod tests {
encoded: String::from("http://localhost:8000/querystring-params"),
}],
quotes: false,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
line_terminator0: line_terminator.clone(),
headers: vec![],
@ -277,7 +277,7 @@ mod tests {
quotes: false,
value: "param1".to_string(),
encoded: "param1".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
Template {
quotes: false,
@ -285,11 +285,11 @@ mod tests {
space0: whitespace(),
variable: Variable {
name: String::from("param1"),
source_info: SourceInfo::init(1, 7, 1, 15),
source_info: SourceInfo::new(1, 7, 1, 15),
},
space1: whitespace(),
})],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
),
simple_key_value(
@ -297,7 +297,7 @@ mod tests {
quotes: false,
value: "param2".to_string(),
encoded: "param2".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
Template {
quotes: false,
@ -305,14 +305,14 @@ mod tests {
value: "a b".to_string(),
encoded: "a b".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
),
]),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}],
body: None,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}
}
@ -322,7 +322,7 @@ mod tests {
let error = eval_request(&hello_request(), &variables, &ContextDir::default())
.err()
.unwrap();
assert_eq!(error.source_info, SourceInfo::init(1, 7, 1, 15));
assert_eq!(error.source_info, SourceInfo::new(1, 7, 1, 15));
assert_eq!(
error.inner,
RunnerError::TemplateVariableNotDefined {
@ -381,13 +381,13 @@ mod tests {
encoded: String::from("http://localhost"),
},],
quotes: false,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
line_terminator0: line_terminator,
headers: vec![],
sections: vec![],
body: None,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}));
}
@ -421,13 +421,13 @@ mod tests {
encoded: String::from("http://localhost"),
},],
quotes: false,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
line_terminator0: line_terminator,
headers: vec![],
sections: vec![],
body: None,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
})
);
}

View File

@ -310,7 +310,7 @@ mod tests {
pub fn user_response() -> Response {
let whitespace = Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
};
let line_terminator = LineTerminator {
space0: whitespace.clone(),
@ -322,12 +322,12 @@ mod tests {
line_terminators: vec![],
version: Version {
value: VersionValue::Version1,
source_info: SourceInfo::init(2, 6, 2, 9),
source_info: SourceInfo::new(2, 6, 2, 9),
},
space0: whitespace.clone(),
status: Status {
value: StatusValue::Specific(200),
source_info: SourceInfo::init(2, 10, 2, 13),
source_info: SourceInfo::new(2, 10, 2, 13),
},
space1: whitespace.clone(),
line_terminator0: line_terminator.clone(),
@ -338,18 +338,18 @@ mod tests {
space0: whitespace.clone(),
line_terminator0: line_terminator.clone(),
value: SectionValue::Asserts(vec![assert::tests::assert_count_user()]),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
Section {
line_terminators: vec![],
space0: whitespace,
line_terminator0: line_terminator,
value: SectionValue::Captures(vec![capture::tests::user_count_capture()]),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
],
body: None,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}
}
@ -368,18 +368,18 @@ mod tests {
AssertResult::Version {
actual: String::from("1.0"),
expected: String::from("1.0"),
source_info: SourceInfo::init(2, 6, 2, 9),
source_info: SourceInfo::new(2, 6, 2, 9),
},
AssertResult::Status {
actual: 200,
expected: 200,
source_info: SourceInfo::init(2, 10, 2, 13),
source_info: SourceInfo::new(2, 10, 2, 13),
},
AssertResult::Explicit {
actual: Ok(Some(Value::Nodeset(2))),
source_info: SourceInfo::init(1, 14, 1, 27),
source_info: SourceInfo::new(1, 14, 1, 27),
predicate_result: Some(Err(Error {
source_info: SourceInfo::init(1, 0, 1, 0),
source_info: SourceInfo::new(1, 0, 1, 0),
inner: RunnerError::AssertFailure {
actual: "2".to_string(),
expected: "3".to_string(),

View File

@ -99,10 +99,10 @@ pub mod tests {
let variables = HashMap::new();
let whitespace = Whitespace {
value: String::from(""),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
let subquery = Subquery {
source_info: SourceInfo::init(1, 1, 1, 20),
source_info: SourceInfo::new(1, 1, 1, 20),
value: SubqueryValue::Regex {
space0: whitespace,
value: RegexValue::Template(Template {
@ -111,7 +111,7 @@ pub mod tests {
value: "Hello (.*)!".to_string(),
encoded: "Hello (.*)!".to_string(),
}],
source_info: SourceInfo::init(1, 7, 1, 20),
source_info: SourceInfo::new(1, 7, 1, 20),
}),
},
};
@ -129,7 +129,7 @@ pub mod tests {
let error = eval_subquery(subquery, Value::Bool(true), &variables)
.err()
.unwrap();
assert_eq!(error.source_info, SourceInfo::init(1, 1, 1, 20));
assert_eq!(error.source_info, SourceInfo::new(1, 1, 1, 20));
assert_eq!(
error.inner,
RunnerError::SubqueryInvalidInput("boolean".to_string())
@ -141,10 +141,10 @@ pub mod tests {
let variables = HashMap::new();
let whitespace = Whitespace {
value: String::from(""),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
let subquery = Subquery {
source_info: SourceInfo::init(1, 1, 1, 20),
source_info: SourceInfo::new(1, 1, 1, 20),
value: SubqueryValue::Regex {
space0: whitespace,
value: RegexValue::Template(Template {
@ -153,7 +153,7 @@ pub mod tests {
value: "???".to_string(),
encoded: "???".to_string(),
}],
source_info: SourceInfo::init(1, 7, 1, 20),
source_info: SourceInfo::new(1, 7, 1, 20),
}),
},
};
@ -164,7 +164,7 @@ pub mod tests {
)
.err()
.unwrap();
assert_eq!(error.source_info, SourceInfo::init(1, 7, 1, 20));
assert_eq!(error.source_info, SourceInfo::new(1, 7, 1, 20));
assert_eq!(error.inner, RunnerError::InvalidRegex {});
}
@ -172,7 +172,7 @@ pub mod tests {
fn test_subquery_count() {
let variables = HashMap::new();
let subquery = Subquery {
source_info: SourceInfo::init(1, 1, 1, 20),
source_info: SourceInfo::new(1, 1, 1, 20),
value: SubqueryValue::Count {},
};
assert_eq!(
@ -193,7 +193,7 @@ pub mod tests {
let error = eval_subquery(subquery, Value::Bool(true), &variables)
.err()
.unwrap();
assert_eq!(error.source_info, SourceInfo::init(1, 1, 1, 20));
assert_eq!(error.source_info, SourceInfo::new(1, 1, 1, 20));
assert_eq!(
error.inner,
RunnerError::SubqueryInvalidInput("boolean".to_string())

View File

@ -93,15 +93,15 @@ mod tests {
TemplateElement::Expression(Expr {
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 3, 1, 3),
source_info: SourceInfo::new(1, 3, 1, 3),
},
variable: Variable {
name: "name".to_string(),
source_info: SourceInfo::init(1, 3, 1, 7),
source_info: SourceInfo::new(1, 3, 1, 7),
},
space1: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 7, 1, 7),
source_info: SourceInfo::new(1, 7, 1, 7),
},
})
}
@ -139,7 +139,7 @@ mod tests {
let error = eval_template_element(&template_element_expression(), &variables)
.err()
.unwrap();
assert_eq!(error.source_info, SourceInfo::init(1, 3, 1, 7));
assert_eq!(error.source_info, SourceInfo::new(1, 3, 1, 7));
assert_eq!(
error.inner,
RunnerError::UnrenderableVariable {

View File

@ -501,7 +501,7 @@ HTTP/1.0 200
"#;
let filename = "test.hurl";
let error = runner::Error {
source_info: SourceInfo::init(2, 10, 2, 13),
source_info: SourceInfo::new(2, 10, 2, 13),
inner: runner::RunnerError::AssertStatus {
actual: "404".to_string(),
},
@ -527,7 +527,7 @@ xpath "strong(//head/title)" equals "Hello"
"#;
let filename = "test.hurl";
let error = runner::Error {
source_info: SourceInfo::init(4, 7, 4, 29),
source_info: SourceInfo::new(4, 7, 4, 29),
inner: runner::RunnerError::QueryInvalidXpathEval {},
assert: true,
};
@ -551,7 +551,7 @@ jsonpath "$.count" >= 5
"#;
let filename = "test.hurl";
let error = runner::Error {
source_info: SourceInfo::init(4, 0, 4, 0),
source_info: SourceInfo::new(4, 0, 4, 0),
inner: runner::RunnerError::AssertFailure {
actual: "int <2>".to_string(),
expected: "greater than int <5>".to_string(),
@ -580,7 +580,7 @@ HTTP/1.0 200
"#;
let filename = "test.hurl";
let error = runner::Error {
source_info: SourceInfo::init(3, 4, 4, 1),
source_info: SourceInfo::new(3, 4, 4, 1),
inner: runner::RunnerError::AssertBodyValueError {
actual: "<p>Hello</p>\n\n".to_string(),
expected: "<p>Hello</p>\n".to_string(),

View File

@ -633,7 +633,7 @@ pub struct SourceInfo {
}
impl SourceInfo {
pub fn init(
pub fn new(
start_line: usize,
start_col: usize,
end_line: usize,

View File

@ -211,7 +211,7 @@ mod tests {
fn whitespace() -> Whitespace {
Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}
}
@ -220,7 +220,7 @@ mod tests {
space0: whitespace(),
variable: Variable {
name: "name".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space1: whitespace(),
}
@ -240,7 +240,7 @@ mod tests {
encoded: "!".to_string(),
},
],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}
}
@ -295,7 +295,7 @@ mod tests {
value: "LSID".to_string(),
encoded: "unused".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
attribute: Some(CookieAttribute {
space0: whitespace(),

View File

@ -224,15 +224,15 @@ mod tests {
JsonValue::Expression(Expr {
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
variable: Variable {
name: "x".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space1: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
})
.to_string()
@ -249,7 +249,7 @@ mod tests {
value: "hello".to_string(),
encoded: "hello".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
})
.to_string()
);
@ -306,7 +306,7 @@ mod tests {
value: "id".to_string(),
encoded: "id".to_string(),
}],
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
},
space1: "".to_string(),
space2: " ".to_string(),
@ -325,15 +325,15 @@ mod tests {
TemplateElement::Expression(Expr {
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
},
variable: Variable {
name: "name".to_string(),
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
},
space1: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
},
})
.encoded(),
@ -345,18 +345,18 @@ mod tests {
elements: vec![TemplateElement::Expression(Expr {
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
},
variable: Variable {
name: "name".to_string(),
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
},
space1: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
},
})],
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
}
.encoded(),
"{{name}}".to_string()

View File

@ -986,7 +986,7 @@ mod tests {
let raw_string = RawString {
newline: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
value: Template {
quotes: false,
@ -994,7 +994,7 @@ mod tests {
value: "".to_string(),
encoded: "unused".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
};
assert_eq!(
@ -1006,7 +1006,7 @@ mod tests {
let raw_string = RawString {
newline: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
value: Template {
quotes: false,
@ -1014,7 +1014,7 @@ mod tests {
value: "hello".to_string(),
encoded: "unused".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
};
assert_eq!(
@ -1029,7 +1029,7 @@ mod tests {
let raw_string = RawString {
newline: Whitespace {
value: "\n".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
value: Template {
quotes: false,
@ -1037,7 +1037,7 @@ mod tests {
value: "line1\nline2\n".to_string(),
encoded: "unused".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
};
assert_eq!(
@ -1070,7 +1070,7 @@ mod tests {
value: "id".to_string(),
encoded: "id".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space1: "".to_string(),
space2: " ".to_string(),
@ -1092,7 +1092,7 @@ mod tests {
value: "\n".to_string(),
encoded: "\\n".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
});
assert_eq!(
value.to_html(),

View File

@ -132,7 +132,7 @@ mod tests {
value: JsonValue::String(Template {
quotes: true,
elements: vec![],
source_info: SourceInfo::init(1, 2, 1, 2),
source_info: SourceInfo::new(1, 2, 1, 2),
})
}
);

View File

@ -98,7 +98,7 @@ mod tests {
value: "cookie1".to_string(),
encoded: "cookie1".to_string(),
}],
source_info: SourceInfo::init(1, 1, 1, 8),
source_info: SourceInfo::new(1, 1, 1, 8),
},
attribute: None,
}
@ -118,17 +118,17 @@ mod tests {
value: "cookie1".to_string(),
encoded: "cookie1".to_string(),
}],
source_info: SourceInfo::init(1, 1, 1, 8),
source_info: SourceInfo::new(1, 1, 1, 8),
},
attribute: Some(CookieAttribute {
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 9, 1, 9),
source_info: SourceInfo::new(1, 9, 1, 9),
},
name: CookieAttributeName::Domain("Domain".to_string()),
space1: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 15, 1, 15),
source_info: SourceInfo::new(1, 15, 1, 15),
},
}),
}
@ -147,28 +147,28 @@ mod tests {
elements: vec![TemplateElement::Expression(Expr {
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 3, 1, 3),
source_info: SourceInfo::new(1, 3, 1, 3),
},
variable: Variable {
name: "name".to_string(),
source_info: SourceInfo::init(1, 3, 1, 7),
source_info: SourceInfo::new(1, 3, 1, 7),
},
space1: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 7, 1, 7),
source_info: SourceInfo::new(1, 7, 1, 7),
},
})],
source_info: SourceInfo::init(1, 1, 1, 9),
source_info: SourceInfo::new(1, 1, 1, 9),
},
attribute: Some(CookieAttribute {
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 10, 1, 10),
source_info: SourceInfo::new(1, 10, 1, 10),
},
name: CookieAttributeName::Domain("Domain".to_string()),
space1: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 16, 1, 16),
source_info: SourceInfo::new(1, 16, 1, 16),
},
}),
}

View File

@ -68,7 +68,7 @@ fn variable_name(reader: &mut Reader) -> ParseResult<'static, Variable> {
}
Ok(Variable {
name,
source_info: SourceInfo::init(
source_info: SourceInfo::new(
start.pos.line,
start.pos.column,
reader.state.pos.line,
@ -91,15 +91,15 @@ mod tests {
Expr {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 3, 1, 4),
source_info: SourceInfo::new(1, 3, 1, 4),
},
variable: Variable {
name: String::from("name"),
source_info: SourceInfo::init(1, 4, 1, 8),
source_info: SourceInfo::new(1, 4, 1, 8),
},
space1: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 8, 1, 8),
source_info: SourceInfo::new(1, 8, 1, 8),
},
}
);
@ -140,7 +140,7 @@ mod tests {
variable_name(&mut reader).unwrap(),
Variable {
name: String::from("name"),
source_info: SourceInfo::init(1, 1, 1, 5),
source_info: SourceInfo::new(1, 1, 1, 5),
}
);
@ -149,7 +149,7 @@ mod tests {
variable_name(&mut reader).unwrap(),
Variable {
name: String::from("my-id"),
source_info: SourceInfo::init(1, 1, 1, 6),
source_info: SourceInfo::new(1, 1, 1, 6),
}
);
}

View File

@ -60,7 +60,7 @@ mod tests {
parse(&mut reader).unwrap(),
Filename {
value: String::from("data/data.bin"),
source_info: SourceInfo::init(1, 1, 1, 14),
source_info: SourceInfo::new(1, 1, 1, 14),
}
);
assert_eq!(reader.state.cursor, 13);
@ -70,7 +70,7 @@ mod tests {
parse(&mut reader).unwrap(),
Filename {
value: String::from("data.bin"),
source_info: SourceInfo::init(1, 1, 1, 9),
source_info: SourceInfo::new(1, 1, 1, 9),
}
);
assert_eq!(reader.state.cursor, 8);
@ -83,7 +83,7 @@ mod tests {
parse(&mut reader).unwrap(),
Filename {
value: String::from("file with spaces"),
source_info: SourceInfo::init(1, 1, 1, 19),
source_info: SourceInfo::new(1, 1, 1, 19),
}
);
assert_eq!(reader.state.cursor, 18);

View File

@ -432,15 +432,15 @@ mod tests {
TemplateElement::Expression(Expr {
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 15, 1, 15),
source_info: SourceInfo::new(1, 15, 1, 15),
},
variable: Variable {
name: "name".to_string(),
source_info: SourceInfo::init(1, 15, 1, 19),
source_info: SourceInfo::new(1, 15, 1, 19),
},
space1: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 19, 1, 19),
source_info: SourceInfo::new(1, 19, 1, 19),
},
}),
TemplateElement::String {
@ -448,7 +448,7 @@ mod tests {
encoded: "!".to_string(),
},
],
source_info: SourceInfo::init(1, 2, 1, 22),
source_info: SourceInfo::new(1, 2, 1, 22),
})
}
@ -460,7 +460,7 @@ mod tests {
JsonValue::String(Template {
quotes: true,
elements: vec![],
source_info: SourceInfo::init(1, 2, 1, 2),
source_info: SourceInfo::new(1, 2, 1, 2),
})
);
assert_eq!(reader.state.cursor, 2);
@ -478,7 +478,7 @@ mod tests {
value: "{}".to_string(),
encoded: "{}".to_string(),
}],
source_info: SourceInfo::init(1, 2, 1, 4),
source_info: SourceInfo::new(1, 2, 1, 4),
})
);
assert_eq!(reader.state.cursor, 4);
@ -698,15 +698,15 @@ mod tests {
JsonValue::Expression(Expr {
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 3, 1, 3)
source_info: SourceInfo::new(1, 3, 1, 3)
},
variable: Variable {
name: "n".to_string(),
source_info: SourceInfo::init(1, 3, 1, 4)
source_info: SourceInfo::new(1, 3, 1, 4)
},
space1: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 4, 1, 4)
source_info: SourceInfo::new(1, 4, 1, 4)
}
})
);
@ -819,7 +819,7 @@ mod tests {
value: "a".to_string(),
encoded: "a".to_string()
}],
source_info: SourceInfo::init(2, 4, 2, 5)
source_info: SourceInfo::new(2, 4, 2, 5)
},
space1: "".to_string(),
space2: " ".to_string(),
@ -864,7 +864,7 @@ mod tests {
value: "a".to_string(),
encoded: "a".to_string()
}],
source_info: SourceInfo::init(1, 2, 1, 3)
source_info: SourceInfo::new(1, 2, 1, 3)
},
space1: "".to_string(),
space2: " ".to_string(),

View File

@ -57,7 +57,7 @@ fn request(reader: &mut Reader) -> ParseResult<'static, Request> {
let headers = zero_or_more(key_value, reader)?;
let sections = request_sections(reader)?;
let b = optional(body, reader)?;
let source_info = SourceInfo::init(
let source_info = SourceInfo::new(
start.pos.line,
start.pos.column,
reader.state.pos.line,
@ -113,7 +113,7 @@ fn response(reader: &mut Reader) -> ParseResult<'static, Response> {
headers,
sections,
body: b,
source_info: SourceInfo::init(
source_info: SourceInfo::new(
start.pos.line,
start.pos.column,
reader.state.pos.line,
@ -172,7 +172,7 @@ fn version(reader: &mut Reader) -> ParseResult<'static, Version> {
if try_literal(s, reader).is_ok() {
return Ok(Version {
value,
source_info: SourceInfo::init(
source_info: SourceInfo::new(
start.pos.line,
start.pos.column,
reader.state.pos.line,
@ -288,12 +288,12 @@ mod tests {
line_terminators: vec![],
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
},
method: Method::Get,
space1: Whitespace {
value: " ".to_string(),
source_info: SourceInfo::init(1, 4, 1, 5),
source_info: SourceInfo::new(1, 4, 1, 5),
},
url: Template {
elements: vec![TemplateElement::String {
@ -301,23 +301,23 @@ mod tests {
encoded: String::from("http://google.fr"),
}],
quotes: false,
source_info: SourceInfo::init(1, 5, 1, 21),
source_info: SourceInfo::new(1, 5, 1, 21),
},
line_terminator0: LineTerminator {
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 21, 1, 21),
source_info: SourceInfo::new(1, 21, 1, 21),
},
comment: None,
newline: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 21, 1, 21),
source_info: SourceInfo::new(1, 21, 1, 21),
},
},
headers: vec![],
sections: vec![],
body: None,
source_info: SourceInfo::init(1, 1, 1, 21),
source_info: SourceInfo::new(1, 1, 1, 21),
};
assert_eq!(request(&mut reader), Ok(default_request));
@ -326,12 +326,12 @@ mod tests {
line_terminators: vec![],
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
},
method: Method::Get,
space1: Whitespace {
value: " ".to_string(),
source_info: SourceInfo::init(1, 4, 1, 6),
source_info: SourceInfo::new(1, 4, 1, 6),
},
url: Template {
elements: vec![TemplateElement::String {
@ -339,25 +339,25 @@ mod tests {
encoded: String::from("http://google.fr"),
}],
quotes: false,
source_info: SourceInfo::init(1, 6, 1, 22),
source_info: SourceInfo::new(1, 6, 1, 22),
},
line_terminator0: LineTerminator {
space0: Whitespace {
value: " ".to_string(),
source_info: SourceInfo::init(1, 22, 1, 23),
source_info: SourceInfo::new(1, 22, 1, 23),
},
comment: Some(Comment {
value: " comment".to_string(),
}),
newline: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 32, 1, 32),
source_info: SourceInfo::new(1, 32, 1, 32),
},
},
headers: vec![],
sections: vec![],
body: None,
source_info: SourceInfo::init(1, 1, 1, 32),
source_info: SourceInfo::new(1, 1, 1, 32),
};
assert_eq!(request(&mut reader), Ok(default_request));
@ -383,12 +383,12 @@ mod tests {
line_terminators: vec![],
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(2, 1, 2, 1),
source_info: SourceInfo::new(2, 1, 2, 1),
},
value: Bytes::RawString(RawString {
newline: Whitespace {
value: "\n".to_string(),
source_info: SourceInfo::init(2, 4, 3, 1),
source_info: SourceInfo::new(2, 4, 3, 1),
},
value: Template {
elements: vec![TemplateElement::String {
@ -396,18 +396,18 @@ mod tests {
encoded: String::from("Hello World!\n"),
}],
quotes: false,
source_info: SourceInfo::init(3, 1, 4, 1),
source_info: SourceInfo::new(3, 1, 4, 1),
},
}),
line_terminator0: LineTerminator {
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(4, 4, 4, 4),
source_info: SourceInfo::new(4, 4, 4, 4),
},
comment: None,
newline: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(4, 4, 4, 4),
source_info: SourceInfo::new(4, 4, 4, 4),
},
},
}
@ -457,7 +457,7 @@ mod tests {
value: "Hello".to_string(),
encoded: "Hello".to_string(),
}],
source_info: SourceInfo::init(2, 2, 2, 7),
source_info: SourceInfo::new(2, 2, 2, 7),
})
}
);

View File

@ -366,7 +366,7 @@ mod tests {
false,
Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
}
)
);
@ -379,7 +379,7 @@ mod tests {
true,
Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 4, 1, 5),
source_info: SourceInfo::new(1, 4, 1, 5),
}
)
);
@ -395,14 +395,14 @@ mod tests {
not: true,
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 4, 1, 5),
source_info: SourceInfo::new(1, 4, 1, 5),
},
predicate_func: PredicateFunc {
source_info: SourceInfo::init(1, 5, 1, 16),
source_info: SourceInfo::new(1, 5, 1, 16),
value: PredicateFuncValue::Equal {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 11, 1, 12),
source_info: SourceInfo::new(1, 11, 1, 12),
},
value: PredicateValue::Bool(true),
operator: false
@ -445,7 +445,7 @@ mod tests {
value: PredicateValue::Bool(true),
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 7, 1, 9),
source_info: SourceInfo::new(1, 7, 1, 9),
},
operator: false
@ -462,7 +462,7 @@ mod tests {
}),
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 7, 1, 8),
source_info: SourceInfo::new(1, 7, 1, 8),
},
operator: false
}
@ -475,7 +475,7 @@ mod tests {
value: PredicateValue::Integer(2),
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 7, 1, 8),
source_info: SourceInfo::new(1, 7, 1, 8),
},
operator: false
},
@ -488,7 +488,7 @@ mod tests {
value: PredicateValue::Integer(2),
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 3, 1, 4),
source_info: SourceInfo::new(1, 3, 1, 4),
},
operator: true
},
@ -504,11 +504,11 @@ mod tests {
value: "Bob".to_string(),
encoded: "Bob".to_string(),
}],
source_info: SourceInfo::init(1, 8, 1, 13),
source_info: SourceInfo::new(1, 8, 1, 13),
}),
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 7, 1, 8),
source_info: SourceInfo::new(1, 7, 1, 8),
},
operator: false
}
@ -524,20 +524,20 @@ mod tests {
value: PredicateValue::Expression(Expr {
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 10, 1, 10),
source_info: SourceInfo::new(1, 10, 1, 10),
},
variable: Variable {
name: "count".to_string(),
source_info: SourceInfo::init(1, 10, 1, 15),
source_info: SourceInfo::new(1, 10, 1, 15),
},
space1: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 15, 1, 15),
source_info: SourceInfo::new(1, 15, 1, 15),
},
}),
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 7, 1, 8),
source_info: SourceInfo::new(1, 7, 1, 8),
},
operator: false
}
@ -553,7 +553,7 @@ mod tests {
value: PredicateValue::Integer(2),
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 12, 1, 13),
source_info: SourceInfo::new(1, 12, 1, 13),
},
}
);

View File

@ -38,7 +38,7 @@ pub fn space(reader: &mut Reader) -> ParseResult<'static, Whitespace> {
if c == ' ' || c == '\t' {
Ok(Whitespace {
value: c.to_string(),
source_info: SourceInfo::init(
source_info: SourceInfo::new(
start.pos.line,
start.pos.column,
reader.state.pos.line,
@ -63,7 +63,7 @@ pub fn one_or_more_spaces<'a>(reader: &mut Reader) -> ParseResult<'a, Whitespace
let s = v.iter().map(|x| x.value.clone()).collect();
Ok(Whitespace {
value: s,
source_info: SourceInfo::init(
source_info: SourceInfo::new(
start.pos.line,
start.pos.column,
reader.state.pos.line,
@ -83,7 +83,7 @@ pub fn zero_or_more_spaces<'a>(reader: &mut Reader) -> ParseResult<'a, Whitespac
let s = v.iter().map(|x| x.value.clone()).collect();
Ok(Whitespace {
value: s,
source_info: SourceInfo::init(
source_info: SourceInfo::new(
start.pos.line,
start.pos.column,
reader.state.pos.line,
@ -102,7 +102,7 @@ pub fn line_terminator(reader: &mut Reader) -> ParseResult<'static, LineTerminat
let nl = if reader.is_eof() {
Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(
source_info: SourceInfo::new(
reader.state.pos.line,
reader.state.pos.column,
reader.state.pos.line,
@ -241,7 +241,7 @@ pub fn newline(reader: &mut Reader) -> ParseResult<'static, Whitespace> {
match try_literal("\r\n", reader) {
Ok(_) => Ok(Whitespace {
value: "\r\n".to_string(),
source_info: SourceInfo::init(
source_info: SourceInfo::new(
start.pos.line,
start.pos.column,
reader.state.pos.line,
@ -251,7 +251,7 @@ pub fn newline(reader: &mut Reader) -> ParseResult<'static, Whitespace> {
Err(_) => match literal("\n", reader) {
Ok(_) => Ok(Whitespace {
value: "\n".to_string(),
source_info: SourceInfo::init(
source_info: SourceInfo::new(
start.pos.line,
start.pos.column,
reader.state.pos.line,
@ -666,7 +666,7 @@ mod tests {
space(&mut reader),
Ok(Whitespace {
value: " ".to_string(),
source_info: SourceInfo::init(1, 1, 1, 2),
source_info: SourceInfo::new(1, 1, 1, 2),
}),
);
assert_eq!(reader.state.cursor, 1);
@ -679,7 +679,7 @@ mod tests {
one_or_more_spaces(&mut reader),
Ok(Whitespace {
value: " ".to_string(),
source_info: SourceInfo::init(1, 1, 1, 3),
source_info: SourceInfo::new(1, 1, 1, 3),
})
);
@ -695,7 +695,7 @@ mod tests {
zero_or_more_spaces(&mut reader),
Ok(Whitespace {
value: " ".to_string(),
source_info: SourceInfo::init(1, 1, 1, 3),
source_info: SourceInfo::new(1, 1, 1, 3),
})
);
assert_eq!(reader.state.cursor, 2);
@ -705,7 +705,7 @@ mod tests {
zero_or_more_spaces(&mut reader),
Ok(Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
})
);
assert_eq!(reader.state.cursor, 0);
@ -715,7 +715,7 @@ mod tests {
zero_or_more_spaces(&mut reader),
Ok(Whitespace {
value: " ".to_string(),
source_info: SourceInfo::init(1, 1, 1, 2),
source_info: SourceInfo::new(1, 1, 1, 2),
})
);
assert_eq!(reader.state.cursor, 1);
@ -802,7 +802,7 @@ mod tests {
newline(&mut reader).unwrap(),
Whitespace {
value: String::from("\n"),
source_info: SourceInfo::init(1, 1, 2, 1),
source_info: SourceInfo::new(1, 1, 2, 1),
}
);
}
@ -816,21 +816,21 @@ mod tests {
line_terminators: vec![],
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
},
key: EncodedString {
quotes: false,
value: "message".to_string(),
encoded: "message".to_string(),
source_info: SourceInfo::init(1, 1, 1, 8),
source_info: SourceInfo::new(1, 1, 1, 8),
},
space1: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 8, 1, 8),
source_info: SourceInfo::new(1, 8, 1, 8),
},
space2: Whitespace {
value: " ".to_string(),
source_info: SourceInfo::init(1, 9, 1, 10),
source_info: SourceInfo::new(1, 9, 1, 10),
},
value: Template {
quotes: false,
@ -842,15 +842,15 @@ mod tests {
TemplateElement::Expression(Expr {
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 18, 1, 18),
source_info: SourceInfo::new(1, 18, 1, 18),
},
variable: Variable {
name: "name".to_string(),
source_info: SourceInfo::init(1, 18, 1, 22),
source_info: SourceInfo::new(1, 18, 1, 22),
},
space1: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 22, 1, 22),
source_info: SourceInfo::new(1, 22, 1, 22),
},
}),
TemplateElement::String {
@ -858,19 +858,19 @@ mod tests {
encoded: "!".to_string(),
},
],
source_info: SourceInfo::init(1, 10, 1, 25),
source_info: SourceInfo::new(1, 10, 1, 25),
},
line_terminator0: LineTerminator {
space0: Whitespace {
value: " ".to_string(),
source_info: SourceInfo::init(1, 25, 1, 26),
source_info: SourceInfo::new(1, 25, 1, 26),
},
comment: Some(Comment {
value: " comment".to_string()
}),
newline: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 35, 1, 35),
source_info: SourceInfo::new(1, 35, 1, 35),
},
},
}
@ -1128,12 +1128,12 @@ mod tests {
RawString {
newline: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 4, 1, 4),
source_info: SourceInfo::new(1, 4, 1, 4),
},
value: Template {
quotes: false,
elements: vec![],
source_info: SourceInfo::init(1, 4, 1, 4),
source_info: SourceInfo::new(1, 4, 1, 4),
},
}
);
@ -1144,12 +1144,12 @@ mod tests {
RawString {
newline: Whitespace {
value: String::from("\n"),
source_info: SourceInfo::init(1, 4, 2, 1),
source_info: SourceInfo::new(1, 4, 2, 1),
},
value: Template {
quotes: false,
elements: vec![],
source_info: SourceInfo::init(2, 1, 2, 1),
source_info: SourceInfo::new(2, 1, 2, 1),
},
}
);
@ -1159,12 +1159,12 @@ mod tests {
RawString {
newline: Whitespace {
value: String::from("\r\n"),
source_info: SourceInfo::init(1, 4, 2, 1),
source_info: SourceInfo::new(1, 4, 2, 1),
},
value: Template {
quotes: false,
elements: vec![],
source_info: SourceInfo::init(2, 1, 2, 1),
source_info: SourceInfo::new(2, 1, 2, 1),
},
}
);
@ -1178,7 +1178,7 @@ mod tests {
RawString {
newline: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 4, 1, 4),
source_info: SourceInfo::new(1, 4, 1, 4),
},
value: Template {
quotes: false,
@ -1186,7 +1186,7 @@ mod tests {
value: "Hello World!".to_string(),
encoded: "Hello World!".to_string(),
}],
source_info: SourceInfo::init(1, 4, 1, 16),
source_info: SourceInfo::new(1, 4, 1, 16),
},
}
);
@ -1196,7 +1196,7 @@ mod tests {
RawString {
newline: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 4, 1, 4),
source_info: SourceInfo::new(1, 4, 1, 4),
},
value: Template {
quotes: false,
@ -1204,7 +1204,7 @@ mod tests {
value: "Hello\nWorld!\n".to_string(),
encoded: "Hello\nWorld!\n".to_string(),
}],
source_info: SourceInfo::init(1, 4, 3, 1),
source_info: SourceInfo::new(1, 4, 3, 1),
},
}
);
@ -1218,7 +1218,7 @@ mod tests {
RawString {
newline: Whitespace {
value: String::from("\n"),
source_info: SourceInfo::init(1, 4, 2, 1),
source_info: SourceInfo::new(1, 4, 2, 1),
},
value: Template {
quotes: false,
@ -1226,7 +1226,7 @@ mod tests {
value: "line1\nline2\nline3\n".to_string(),
encoded: "line1\nline2\nline3\n".to_string(),
}],
source_info: SourceInfo::init(2, 1, 5, 1),
source_info: SourceInfo::new(2, 1, 5, 1),
},
}
);
@ -1242,7 +1242,7 @@ mod tests {
RawString {
newline: Whitespace {
value: String::from("\n"),
source_info: SourceInfo::init(1, 4, 2, 1),
source_info: SourceInfo::new(1, 4, 2, 1),
},
value: Template {
quotes: false,
@ -1250,7 +1250,7 @@ mod tests {
value: "\n".to_string(),
encoded: "\n".to_string(),
}],
source_info: SourceInfo::init(2, 1, 3, 1),
source_info: SourceInfo::new(2, 1, 3, 1),
},
}
);
@ -1262,7 +1262,7 @@ mod tests {
RawString {
newline: Whitespace {
value: String::from("\n"),
source_info: SourceInfo::init(1, 4, 2, 1),
source_info: SourceInfo::new(1, 4, 2, 1),
},
value: Template {
quotes: false,
@ -1270,7 +1270,7 @@ mod tests {
value: "\r\n".to_string(),
encoded: "\r\n".to_string(),
}],
source_info: SourceInfo::init(2, 1, 3, 1),
source_info: SourceInfo::new(2, 1, 3, 1),
},
}
);
@ -1320,7 +1320,7 @@ mod tests {
Template {
quotes: false,
elements: vec![],
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
}
);
assert_eq!(reader.state.cursor, 3);
@ -1334,7 +1334,7 @@ mod tests {
value: "hello".to_string(),
encoded: "hello".to_string(),
}],
source_info: SourceInfo::init(1, 1, 1, 6),
source_info: SourceInfo::new(1, 1, 1, 6),
}
);
assert_eq!(reader.state.cursor, 8);
@ -1360,13 +1360,13 @@ mod tests {
Hex {
space0: Whitespace {
value: " ".to_string(),
source_info: SourceInfo::init(1, 5, 1, 6),
source_info: SourceInfo::new(1, 5, 1, 6),
},
value: vec![255],
encoded: "ff".to_string(),
space1: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 8, 1, 8),
source_info: SourceInfo::new(1, 8, 1, 8),
},
}
);
@ -1377,13 +1377,13 @@ mod tests {
Hex {
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 5, 1, 5),
source_info: SourceInfo::new(1, 5, 1, 5),
},
value: vec![1, 2, 3],
encoded: "010203".to_string(),
space1: Whitespace {
value: " ".to_string(),
source_info: SourceInfo::init(1, 11, 1, 12),
source_info: SourceInfo::new(1, 11, 1, 12),
},
}
);
@ -1465,15 +1465,15 @@ mod tests {
File {
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 6, 1, 6),
source_info: SourceInfo::new(1, 6, 1, 6),
},
filename: Filename {
value: String::from("data.xml"),
source_info: SourceInfo::init(1, 6, 1, 14),
source_info: SourceInfo::new(1, 6, 1, 14),
},
space1: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 14, 1, 14),
source_info: SourceInfo::new(1, 14, 1, 14),
},
}
);
@ -1484,15 +1484,15 @@ mod tests {
File {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 6, 1, 7),
source_info: SourceInfo::new(1, 6, 1, 7),
},
filename: Filename {
value: String::from("filename1"),
source_info: SourceInfo::init(1, 7, 1, 16),
source_info: SourceInfo::new(1, 7, 1, 16),
},
space1: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 16, 1, 16),
source_info: SourceInfo::new(1, 16, 1, 16),
},
}
);
@ -1503,15 +1503,15 @@ mod tests {
File {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 6, 1, 7),
source_info: SourceInfo::new(1, 6, 1, 7),
},
filename: Filename {
value: String::from("tmp/filename1"),
source_info: SourceInfo::init(1, 7, 1, 20),
source_info: SourceInfo::new(1, 7, 1, 20),
},
space1: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 20, 1, 20),
source_info: SourceInfo::new(1, 20, 1, 20),
},
}
);
@ -1522,15 +1522,15 @@ mod tests {
File {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 6, 1, 7),
source_info: SourceInfo::new(1, 6, 1, 7),
},
filename: Filename {
value: String::from("tmp/filename with spaces.txt"),
source_info: SourceInfo::init(1, 7, 1, 37),
source_info: SourceInfo::new(1, 7, 1, 37),
},
space1: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 37, 1, 37),
source_info: SourceInfo::new(1, 37, 1, 37),
},
}
);
@ -1586,13 +1586,13 @@ mod tests {
Base64 {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 8, 1, 10),
source_info: SourceInfo::new(1, 8, 1, 10),
},
value: vec![77, 97],
encoded: String::from("T WE="),
space1: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 15, 1, 15),
source_info: SourceInfo::new(1, 15, 1, 15),
},
}
);

View File

@ -206,7 +206,7 @@ mod tests {
assert_eq!(
query(&mut reader).unwrap(),
Query {
source_info: SourceInfo::init(1, 1, 1, 7),
source_info: SourceInfo::new(1, 1, 1, 7),
value: QueryValue::Status {},
subquery: None,
}
@ -219,7 +219,7 @@ mod tests {
assert_eq!(
query(&mut reader).unwrap(),
Query {
source_info: SourceInfo::init(1, 1, 1, 7),
source_info: SourceInfo::new(1, 1, 1, 7),
value: QueryValue::Status {},
subquery: None,
}
@ -234,7 +234,7 @@ mod tests {
QueryValue::Header {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 7, 1, 8),
source_info: SourceInfo::new(1, 7, 1, 8),
},
name: Template {
quotes: true,
@ -242,7 +242,7 @@ mod tests {
value: "Foo".to_string(),
encoded: "Foo".to_string(),
}],
source_info: SourceInfo::init(1, 8, 1, 13),
source_info: SourceInfo::new(1, 8, 1, 13),
},
}
);
@ -256,7 +256,7 @@ mod tests {
QueryValue::Cookie {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 7, 1, 8),
source_info: SourceInfo::new(1, 7, 1, 8),
},
expr: CookiePath {
name: Template {
@ -265,17 +265,17 @@ mod tests {
value: "Foo".to_string(),
encoded: "Foo".to_string(),
}],
source_info: SourceInfo::init(1, 9, 1, 12),
source_info: SourceInfo::new(1, 9, 1, 12),
},
attribute: Some(CookieAttribute {
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 13, 1, 13),
source_info: SourceInfo::new(1, 13, 1, 13),
},
name: CookieAttributeName::Domain("Domain".to_string()),
space1: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 19, 1, 19),
source_info: SourceInfo::new(1, 19, 1, 19),
},
}),
},
@ -295,7 +295,7 @@ mod tests {
QueryValue::Xpath {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 6, 1, 7),
source_info: SourceInfo::new(1, 6, 1, 7),
},
expr: Template {
quotes: true,
@ -303,14 +303,14 @@ mod tests {
value: String::from("normalize-space(//head/title)"),
encoded: String::from("normalize-space(//head/title)"),
}],
source_info: SourceInfo::init(1, 7, 1, 38),
source_info: SourceInfo::new(1, 7, 1, 38),
},
},
);
let mut reader = Reader::init("xpath \"normalize-space(//div[contains(concat(' ',normalize-space(@class),' '),' monthly-price ')])\"");
assert_eq!(xpath_query(&mut reader).unwrap(), QueryValue::Xpath {
space0: Whitespace { value: String::from(" "), source_info: SourceInfo::init(1, 6, 1, 7) },
space0: Whitespace { value: String::from(" "), source_info: SourceInfo::new(1, 6, 1, 7) },
expr: Template {
quotes: true,
elements: vec![
@ -319,7 +319,7 @@ mod tests {
encoded: String::from("normalize-space(//div[contains(concat(' ',normalize-space(@class),' '),' monthly-price ')])"),
}
],
source_info: SourceInfo::init(1, 7, 1, 100),
source_info: SourceInfo::new(1, 7, 1, 100),
},
});
@ -333,7 +333,7 @@ mod tests {
QueryValue::Jsonpath {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 9, 1, 10),
source_info: SourceInfo::new(1, 9, 1, 10),
},
expr: Template {
elements: vec![TemplateElement::String {
@ -342,7 +342,7 @@ mod tests {
}],
quotes: true,
//delimiter: "\"".to_string(),
source_info: SourceInfo::init(1, 10, 1, 27),
source_info: SourceInfo::new(1, 10, 1, 27),
},
},
);
@ -352,7 +352,7 @@ mod tests {
QueryValue::Jsonpath {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 9, 1, 10),
source_info: SourceInfo::new(1, 9, 1, 10),
},
expr: Template {
elements: vec![TemplateElement::String {
@ -361,7 +361,7 @@ mod tests {
}],
quotes: true,
//delimiter: "\"".to_string(),
source_info: SourceInfo::init(1, 10, 1, 21),
source_info: SourceInfo::new(1, 10, 1, 21),
},
},
);

View File

@ -511,31 +511,31 @@ mod tests {
line_terminators: vec![],
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
},
line_terminator0: LineTerminator {
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 10, 1, 10),
source_info: SourceInfo::new(1, 10, 1, 10),
},
comment: None,
newline: Whitespace {
value: String::from("\n"),
source_info: SourceInfo::init(1, 10, 2, 1),
source_info: SourceInfo::new(1, 10, 2, 1),
},
},
value: SectionValue::Asserts(vec![Assert {
line_terminators: vec![],
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(2, 1, 2, 1),
source_info: SourceInfo::new(2, 1, 2, 1),
},
query: Query {
source_info: SourceInfo::init(2, 1, 2, 18),
source_info: SourceInfo::new(2, 1, 2, 18),
value: QueryValue::Header {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(2, 7, 2, 8),
source_info: SourceInfo::new(2, 7, 2, 8),
},
name: Template {
quotes: true,
@ -543,27 +543,27 @@ mod tests {
value: "Location".to_string(),
encoded: "Location".to_string(),
}],
source_info: SourceInfo::init(2, 8, 2, 18),
source_info: SourceInfo::new(2, 8, 2, 18),
},
},
subquery: None,
},
space1: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(2, 18, 2, 19),
source_info: SourceInfo::new(2, 18, 2, 19),
},
predicate: Predicate {
not: false,
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(2, 19, 2, 19),
source_info: SourceInfo::new(2, 19, 2, 19),
},
predicate_func: PredicateFunc {
source_info: SourceInfo::init(2, 19, 2, 45),
source_info: SourceInfo::new(2, 19, 2, 45),
value: PredicateFuncValue::Equal {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(2, 25, 2, 26),
source_info: SourceInfo::new(2, 25, 2, 26),
},
value: PredicateValue::String(Template {
quotes: true,
@ -571,7 +571,7 @@ mod tests {
value: "https://google.fr".to_string(),
encoded: "https://google.fr".to_string(),
}],
source_info: SourceInfo::init(2, 26, 2, 45),
source_info: SourceInfo::new(2, 26, 2, 45),
}),
operator: false,
},
@ -580,16 +580,16 @@ mod tests {
line_terminator0: LineTerminator {
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(2, 45, 2, 45),
source_info: SourceInfo::new(2, 45, 2, 45),
},
comment: None,
newline: Whitespace {
value: String::from("\n"),
source_info: SourceInfo::init(2, 45, 3, 1),
source_info: SourceInfo::new(2, 45, 3, 1),
},
},
}]),
source_info: SourceInfo::init(1, 1, 1, 10),
source_info: SourceInfo::new(1, 1, 1, 10),
}
);
}
@ -633,7 +633,7 @@ mod tests {
value: "Bar".to_string(),
encoded: "Bar".to_string(),
}],
source_info: SourceInfo::init(1, 6, 1, 9),
source_info: SourceInfo::new(1, 6, 1, 9),
}
);
}
@ -821,19 +821,19 @@ mod tests {
FileValue {
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 6, 1, 6),
source_info: SourceInfo::new(1, 6, 1, 6),
},
filename: Filename {
value: "hello.txt".to_string(),
source_info: SourceInfo::init(1, 6, 1, 15),
source_info: SourceInfo::new(1, 6, 1, 15),
},
space1: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 15, 1, 15),
source_info: SourceInfo::new(1, 15, 1, 15),
},
space2: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 16, 1, 16),
source_info: SourceInfo::new(1, 16, 1, 16),
},
content_type: None,
}
@ -844,19 +844,19 @@ mod tests {
FileValue {
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 6, 1, 6),
source_info: SourceInfo::new(1, 6, 1, 6),
},
filename: Filename {
value: "hello.txt".to_string(),
source_info: SourceInfo::init(1, 6, 1, 15),
source_info: SourceInfo::new(1, 6, 1, 15),
},
space1: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 15, 1, 15),
source_info: SourceInfo::new(1, 15, 1, 15),
},
space2: Whitespace {
value: " ".to_string(),
source_info: SourceInfo::init(1, 16, 1, 17),
source_info: SourceInfo::new(1, 16, 1, 17),
},
content_type: Some("text/html".to_string()),
}
@ -898,17 +898,17 @@ mod tests {
quotes: false,
value: String::from("url"),
encoded: String::from("url"),
source_info: SourceInfo::init(1, 1, 1, 4),
source_info: SourceInfo::new(1, 1, 1, 4),
}
);
assert_eq!(
capture0.query,
Query {
source_info: SourceInfo::init(1, 6, 1, 23),
source_info: SourceInfo::new(1, 6, 1, 23),
value: QueryValue::Header {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 12, 1, 13),
source_info: SourceInfo::new(1, 12, 1, 13),
},
name: Template {
quotes: true,
@ -916,7 +916,7 @@ mod tests {
value: "Location".to_string(),
encoded: "Location".to_string(),
}],
source_info: SourceInfo::init(1, 13, 1, 23),
source_info: SourceInfo::new(1, 13, 1, 23),
},
},
subquery: None,
@ -932,11 +932,11 @@ mod tests {
assert_eq!(
capture0.query,
Query {
source_info: SourceInfo::init(1, 8, 1, 25),
source_info: SourceInfo::new(1, 8, 1, 25),
value: QueryValue::Header {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 14, 1, 15),
source_info: SourceInfo::new(1, 14, 1, 15),
},
name: Template {
quotes: true,
@ -944,21 +944,21 @@ mod tests {
value: "Location".to_string(),
encoded: "Location".to_string(),
}],
source_info: SourceInfo::init(1, 15, 1, 25),
source_info: SourceInfo::new(1, 15, 1, 25),
},
},
subquery: Some((
Whitespace {
value: " ".to_string(),
source_info: SourceInfo::init(1, 25, 1, 26),
source_info: SourceInfo::new(1, 25, 1, 26),
},
Subquery {
source_info: SourceInfo::init(1, 26, 1, 44),
source_info: SourceInfo::new(1, 26, 1, 44),
value: SubqueryValue::Regex {
space0: Whitespace {
value: " ".to_string(),
source_info: SourceInfo::init(1, 31, 1, 32),
source_info: SourceInfo::new(1, 31, 1, 32),
},
value: RegexValue::Template(Template {
quotes: true,
@ -966,7 +966,7 @@ mod tests {
value: "token=(.*)".to_string(),
encoded: "token=(.*)".to_string(),
}],
source_info: SourceInfo::init(1, 32, 1, 44),
source_info: SourceInfo::new(1, 32, 1, 44),
}),
},
}
@ -1021,11 +1021,11 @@ mod tests {
assert_eq!(
assert0.query,
Query {
source_info: SourceInfo::init(1, 1, 1, 18),
source_info: SourceInfo::new(1, 1, 1, 18),
value: QueryValue::Header {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 7, 1, 8),
source_info: SourceInfo::new(1, 7, 1, 8),
},
name: Template {
quotes: true,
@ -1033,7 +1033,7 @@ mod tests {
value: "Location".to_string(),
encoded: "Location".to_string(),
}],
source_info: SourceInfo::init(1, 8, 1, 18),
source_info: SourceInfo::new(1, 8, 1, 18),
},
},
subquery: None,
@ -1051,14 +1051,14 @@ mod tests {
not: false,
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 21, 1, 21),
source_info: SourceInfo::new(1, 21, 1, 21),
},
predicate_func: PredicateFunc {
source_info: SourceInfo::init(1, 21, 1, 29),
source_info: SourceInfo::new(1, 21, 1, 29),
value: PredicateFuncValue::Equal {
space0: Whitespace {
value: String::from(" "),
source_info: SourceInfo::init(1, 27, 1, 28),
source_info: SourceInfo::new(1, 27, 1, 28),
},
value: PredicateValue::Integer(5),
operator: false,

View File

@ -296,7 +296,7 @@ mod tests {
Template {
quotes: false,
elements: vec![],
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
}
);
assert_eq!(reader.state.cursor, 0);
@ -325,7 +325,7 @@ mod tests {
value: "a".to_string(),
encoded: "a".to_string(),
}],
source_info: SourceInfo::init(1, 1, 1, 2),
source_info: SourceInfo::new(1, 1, 1, 2),
}
);
assert_eq!(reader.state.cursor, 1);
@ -342,7 +342,7 @@ mod tests {
value: "a#".to_string(),
encoded: "a\\u{23}".to_string(),
}],
source_info: SourceInfo::init(1, 1, 1, 8),
source_info: SourceInfo::new(1, 1, 1, 8),
}
);
assert_eq!(reader.state.cursor, 7);
@ -359,7 +359,7 @@ mod tests {
value: "\"hi\"".to_string(),
encoded: "\"hi\"".to_string(),
}],
source_info: SourceInfo::init(1, 1, 1, 5),
source_info: SourceInfo::new(1, 1, 1, 5),
}
);
assert_eq!(reader.state.cursor, 4);
@ -380,15 +380,15 @@ mod tests {
TemplateElement::Expression(Expr {
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 14, 1, 14),
source_info: SourceInfo::new(1, 14, 1, 14),
},
variable: Variable {
name: "name".to_string(),
source_info: SourceInfo::init(1, 14, 1, 18),
source_info: SourceInfo::new(1, 14, 1, 18),
},
space1: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 18, 1, 18),
source_info: SourceInfo::new(1, 18, 1, 18),
},
}),
TemplateElement::String {
@ -396,7 +396,7 @@ mod tests {
encoded: "!".to_string(),
},
],
source_info: SourceInfo::init(1, 1, 1, 21),
source_info: SourceInfo::new(1, 1, 1, 21),
}
);
assert_eq!(reader.state.cursor, 20);
@ -413,7 +413,7 @@ mod tests {
value: "hello world".to_string(),
encoded: "hello world".to_string(),
},],
source_info: SourceInfo::init(1, 1, 1, 12),
source_info: SourceInfo::new(1, 1, 1, 12),
}
);
assert_eq!(reader.state.cursor, 11);
@ -435,7 +435,7 @@ mod tests {
value: "key".to_string(),
encoded: "key".to_string(),
quotes: false,
source_info: SourceInfo::init(1, 1, 1, 4),
source_info: SourceInfo::new(1, 1, 1, 4),
}
);
assert_eq!(reader.state.cursor, 3);
@ -447,7 +447,7 @@ mod tests {
value: "key :".to_string(),
encoded: "key\\u{20}\\u{3a}".to_string(),
quotes: false,
source_info: SourceInfo::init(1, 1, 1, 16),
source_info: SourceInfo::new(1, 1, 1, 16),
}
);
assert_eq!(reader.state.cursor, 15);
@ -462,7 +462,7 @@ mod tests {
value: "values[0]".to_string(),
encoded: "values\\u{5b}0\\u{5d}".to_string(),
quotes: false,
source_info: SourceInfo::init(1, 1, 1, 20),
source_info: SourceInfo::new(1, 1, 1, 20),
}
);
assert_eq!(reader.state.cursor, 19);
@ -474,7 +474,7 @@ mod tests {
value: "values[0]".to_string(),
encoded: "values[0]".to_string(),
quotes: false,
source_info: SourceInfo::init(1, 1, 1, 10),
source_info: SourceInfo::new(1, 1, 1, 10),
}
);
assert_eq!(reader.state.cursor, 9);
@ -497,7 +497,7 @@ mod tests {
value: "[0]".to_string(),
encoded: "\\u{5b}0\\u{5d}".to_string(),
quotes: false,
source_info: SourceInfo::init(1, 1, 1, 14),
source_info: SourceInfo::new(1, 1, 1, 14),
}
);
assert_eq!(reader.state.cursor, 13);
@ -529,7 +529,7 @@ mod tests {
Template {
quotes: true,
elements: vec![],
source_info: SourceInfo::init(1, 1, 1, 3),
source_info: SourceInfo::new(1, 1, 1, 3),
}
);
assert_eq!(reader.state.cursor, 2);
@ -543,7 +543,7 @@ mod tests {
value: "a#".to_string(),
encoded: "a#".to_string(),
}],
source_info: SourceInfo::init(1, 1, 1, 5),
source_info: SourceInfo::new(1, 1, 1, 5),
}
);
assert_eq!(reader.state.cursor, 4);
@ -557,7 +557,7 @@ mod tests {
value: "{0}".to_string(),
encoded: "{0}".to_string(),
}],
source_info: SourceInfo::init(1, 1, 1, 6),
source_info: SourceInfo::new(1, 1, 1, 6),
}
);
assert_eq!(reader.state.cursor, 5);
@ -575,7 +575,7 @@ mod tests {
value: "\"hi\"".to_string(),
encoded: "\\\"hi\\\"".to_string()
}],
source_info: SourceInfo::init(1, 1, 1, 9),
source_info: SourceInfo::new(1, 1, 1, 9),
}
);
assert_eq!(reader.state.cursor, 8);

View File

@ -71,11 +71,11 @@ mod tests {
assert_eq!(
subquery(&mut reader).unwrap(),
Subquery {
source_info: SourceInfo::init(1, 1, 1, 20),
source_info: SourceInfo::new(1, 1, 1, 20),
value: SubqueryValue::Regex {
space0: Whitespace {
value: " ".to_string(),
source_info: SourceInfo::init(1, 6, 1, 7)
source_info: SourceInfo::new(1, 6, 1, 7)
},
value: RegexValue::Template(Template {
quotes: true,
@ -83,7 +83,7 @@ mod tests {
value: "Hello (.*)!".to_string(),
encoded: "Hello (.*)!".to_string()
}],
source_info: SourceInfo::init(1, 7, 1, 20)
source_info: SourceInfo::new(1, 7, 1, 20)
})
}
}
@ -96,7 +96,7 @@ mod tests {
assert_eq!(
subquery(&mut reader).unwrap(),
Subquery {
source_info: SourceInfo::init(1, 1, 1, 6),
source_info: SourceInfo::new(1, 1, 1, 6),
value: SubqueryValue::Count {}
}
);

View File

@ -139,7 +139,7 @@ mod tests {
#[test]
fn test_templatize_empty_string() {
let encoded_string = EncodedString {
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
chars: vec![],
};
assert_eq!(templatize(encoded_string).unwrap(), vec![]);
@ -149,7 +149,7 @@ mod tests {
fn test_templatize_hello_world() {
// Hi\u0020{{name}}!
let encoded_string = EncodedString {
source_info: SourceInfo::init(1, 1, 1, 18),
source_info: SourceInfo::new(1, 1, 1, 18),
chars: vec![
('H', "H".to_string(), Pos { line: 1, column: 1 }),
('i', "i".to_string(), Pos { line: 1, column: 2 }),
@ -231,15 +231,15 @@ mod tests {
TemplateElement::Expression(Expr {
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 11, 1, 11),
source_info: SourceInfo::new(1, 11, 1, 11),
},
variable: Variable {
name: "name".to_string(),
source_info: SourceInfo::init(1, 11, 1, 15),
source_info: SourceInfo::new(1, 11, 1, 15),
},
space1: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 15, 1, 15),
source_info: SourceInfo::new(1, 15, 1, 15),
},
}),
TemplateElement::String {
@ -254,7 +254,7 @@ mod tests {
fn test_templatize_expression_only() {
// {{x}}!
let encoded_string = EncodedString {
source_info: SourceInfo::init(1, 1, 1, 7),
source_info: SourceInfo::new(1, 1, 1, 7),
chars: vec![
('{', "{".to_string(), Pos { line: 1, column: 1 }),
('{', "{".to_string(), Pos { line: 1, column: 2 }),
@ -268,15 +268,15 @@ mod tests {
vec![TemplateElement::Expression(Expr {
space0: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 3, 1, 3),
source_info: SourceInfo::new(1, 3, 1, 3),
},
variable: Variable {
name: "x".to_string(),
source_info: SourceInfo::init(1, 3, 1, 4),
source_info: SourceInfo::new(1, 3, 1, 4),
},
space1: Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(1, 4, 1, 4),
source_info: SourceInfo::new(1, 4, 1, 4),
},
}),]
);
@ -287,7 +287,7 @@ mod tests {
// missing closing
// {{x
let encoded_string = EncodedString {
source_info: SourceInfo::init(1, 1, 1, 4),
source_info: SourceInfo::new(1, 1, 1, 4),
chars: vec![
('{', "{".to_string(), Pos { line: 1, column: 1 }),
('{', "{".to_string(), Pos { line: 1, column: 2 }),
@ -310,7 +310,7 @@ mod tests {
// \{\{
// This is a valid string "{{"
let encoded_string = EncodedString {
source_info: SourceInfo::init(1, 1, 1, 4),
source_info: SourceInfo::new(1, 1, 1, 4),
chars: vec![
('{', "\\{".to_string(), Pos { line: 1, column: 1 }),
('{', "\\{".to_string(), Pos { line: 1, column: 2 }),

View File

@ -141,7 +141,7 @@ mod tests {
encoded: String::from("http://google.fr"),
}],
quotes: false,
source_info: SourceInfo::init(1, 1, 1, 17),
source_info: SourceInfo::new(1, 1, 1, 17),
}
);
assert_eq!(reader.state.cursor, 16);
@ -160,7 +160,7 @@ mod tests {
),
}],
quotes: false,
source_info: SourceInfo::init(1, 1, 1, 57),
source_info: SourceInfo::new(1, 1, 1, 57),
}
);
assert_eq!(reader.state.cursor, 56);
@ -180,15 +180,15 @@ mod tests {
TemplateElement::Expression(Expr {
space0: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 10, 1, 10),
source_info: SourceInfo::new(1, 10, 1, 10),
},
variable: Variable {
name: String::from("host"),
source_info: SourceInfo::init(1, 10, 1, 14),
source_info: SourceInfo::new(1, 10, 1, 14),
},
space1: Whitespace {
value: String::from(""),
source_info: SourceInfo::init(1, 14, 1, 14),
source_info: SourceInfo::new(1, 14, 1, 14),
},
}),
TemplateElement::String {
@ -198,7 +198,7 @@ mod tests {
],
//encoded: None,
quotes: false,
source_info: SourceInfo::init(1, 1, 1, 19),
source_info: SourceInfo::new(1, 1, 1, 19),
}
);
assert_eq!(reader.state.cursor, 18);

View File

@ -527,7 +527,7 @@ pub mod tests {
fn whitespace() -> Whitespace {
Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}
}
@ -553,7 +553,7 @@ pub mod tests {
value: "http://example.com".to_string(),
encoded: "not_used".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
line_terminator0: line_terminator(),
headers: vec![KeyValue {
@ -563,7 +563,7 @@ pub mod tests {
value: "Foo".to_string(),
encoded: "unused".to_string(),
quotes: false,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space1: whitespace(),
space2: whitespace(),
@ -573,13 +573,13 @@ pub mod tests {
value: "Bar".to_string(),
encoded: "unused".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
line_terminator0: line_terminator(),
}],
sections: vec![],
body: None,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}
.to_json(),
JValue::Object(vec![
@ -606,19 +606,19 @@ pub mod tests {
line_terminators: vec![],
version: Version {
value: VersionValue::Version11,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space0: whitespace(),
status: Status {
value: StatusValue::Specific(200),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space1: whitespace(),
line_terminator0: line_terminator(),
headers: vec![],
sections: vec![],
body: None,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}
.to_json(),
JValue::Object(vec![
@ -634,19 +634,19 @@ pub mod tests {
line_terminators: vec![],
version: Version {
value: VersionValue::VersionAny,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space0: whitespace(),
status: Status {
value: StatusValue::Any,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space1: whitespace(),
line_terminator0: line_terminator(),
headers: vec![],
sections: vec![],
body: None,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}
.to_json(),
JValue::Object(vec![])
@ -655,7 +655,7 @@ pub mod tests {
fn header_query() -> Query {
Query {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: QueryValue::Header {
space0: whitespace(),
name: Template {
@ -664,7 +664,7 @@ pub mod tests {
value: "Content-Length".to_string(),
encoded: "10".to_string(),
}],
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
},
subquery: None,
@ -679,7 +679,7 @@ pub mod tests {
value: "size".to_string(),
encoded: "unused".to_string(),
quotes: false,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space1: whitespace(),
space2: whitespace(),
@ -704,7 +704,7 @@ pub mod tests {
not: false,
space0: whitespace(),
predicate_func: PredicateFunc {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: PredicateFuncValue::Equal {
space0: whitespace(),
value: PredicateValue::Integer(value),

View File

@ -85,7 +85,7 @@ impl Lintable<Request> for Request {
let mut sections: Vec<Section> = self.sections.iter().map(|e| e.lint()).collect();
sections.sort_by_key(|k| section_value_index(k.value.clone()));
let source_info = SourceInfo::init(0, 0, 0, 0);
let source_info = SourceInfo::new(0, 0, 0, 0);
Request {
line_terminators,
space0,
@ -135,7 +135,7 @@ impl Lintable<Response> for Response {
headers,
sections,
body: b,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}
}
}
@ -153,7 +153,7 @@ impl Lintable<Section> for Section {
space0: empty_whitespace(),
value: self.value.lint(),
line_terminator0: self.clone().line_terminator0,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}
}
}
@ -252,7 +252,7 @@ impl Lintable<Query> for Query {
fn lint(&self) -> Query {
Query {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: self.value.lint(),
subquery: self
.subquery
@ -320,7 +320,7 @@ impl Lintable<Subquery> for Subquery {
}
fn lint(&self) -> Subquery {
let source_info = SourceInfo::init(0, 0, 0, 0);
let source_info = SourceInfo::new(0, 0, 0, 0);
let value = self.value.lint();
Subquery { source_info, value }
}
@ -425,7 +425,7 @@ impl Lintable<PredicateFunc> for PredicateFunc {
fn lint(&self) -> PredicateFunc {
PredicateFunc {
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
value: self.value.lint(),
}
}
@ -640,7 +640,7 @@ impl Lintable<File> for File {
space0: one_whitespace(),
filename: Filename {
value: self.filename.clone().value,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
space1: empty_whitespace(),
}
@ -722,14 +722,14 @@ impl Lintable<FileParam> for FileParam {
fn empty_whitespace() -> Whitespace {
Whitespace {
value: "".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}
}
fn one_whitespace() -> Whitespace {
Whitespace {
value: " ".to_string(),
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
}
}
@ -759,7 +759,7 @@ impl Lintable<LineTerminator> for LineTerminator {
None => empty_whitespace(),
Some(_) => Whitespace {
value: self.clone().space0.value,
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
},
};
let comment = self.clone().comment.map(|comment| comment.lint());
@ -769,7 +769,7 @@ impl Lintable<LineTerminator> for LineTerminator {
} else {
"\n".to_string()
},
source_info: SourceInfo::init(0, 0, 0, 0),
source_info: SourceInfo::new(0, 0, 0, 0),
};
LineTerminator {
space0,

View File

@ -55,7 +55,7 @@ fn value_boolean() -> BoxedStrategy<JsonValue> {
}
fn value_string() -> BoxedStrategy<JsonValue> {
let source_info = SourceInfo::init(0, 0, 0, 0);
let source_info = SourceInfo::new(0, 0, 0, 0);
let variable = Variable {
name: "name".to_string(),
source_info: source_info.clone(),
@ -224,7 +224,7 @@ fn value() -> BoxedStrategy<JsonValue> {
value: "key1".to_string(),
encoded: "key1".to_string(),
}],
source_info: SourceInfo::init(1, 1, 1, 1),
source_info: SourceInfo::new(1, 1, 1, 1),
},
space1,
space2,