Skip to content

Commit

Permalink
Rename TemplateElement encoded field to source.
Browse files Browse the repository at this point in the history
  • Loading branch information
jcamiel committed Jan 30, 2025
1 parent 3d39ff0 commit db9b241
Show file tree
Hide file tree
Showing 39 changed files with 195 additions and 195 deletions.
4 changes: 2 additions & 2 deletions packages/hurl/src/runner/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ mod tests {
source_info: SourceInfo::new(Pos::new(1, 7), Pos::new(1, 15)),
elements: vec![TemplateElement::String {
value: "tests/data.bin".to_string(),
encoded: "tests/data.bin".to_string(),
source: "tests/data.bin".to_string(),
}],
},
space1: whitespace,
Expand Down Expand Up @@ -142,7 +142,7 @@ mod tests {
source_info: SourceInfo::new(Pos::new(1, 7), Pos::new(1, 15)),
elements: vec![TemplateElement::String {
value: "data.bin".to_string(),
encoded: "data.bin".to_string(),
source: "data.bin".to_string(),
}],
},
space1: whitespace,
Expand Down
10 changes: 5 additions & 5 deletions packages/hurl/src/runner/capture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub mod tests {
delimiter: None,
elements: vec![TemplateElement::String {
value: "UserCount".to_string(),
encoded: "UserCount".to_string(),
source: "UserCount".to_string(),
}],
source_info: SourceInfo::new(Pos::new(0, 0), Pos::new(0, 0)),
},
Expand Down Expand Up @@ -129,7 +129,7 @@ pub mod tests {
delimiter: None,
elements: vec![TemplateElement::String {
value: "duration".to_string(),
encoded: "duration".to_string(),
source: "duration".to_string(),
}],
source_info: SourceInfo::new(Pos::new(0, 0), Pos::new(0, 0)),
},
Expand Down Expand Up @@ -164,7 +164,7 @@ pub mod tests {
delimiter: None,
elements: vec![TemplateElement::String {
value: "count".to_string(),
encoded: "count".to_string(),
source: "count".to_string(),
}],
source_info: SourceInfo::new(Pos::new(0, 0), Pos::new(0, 0)),
},
Expand Down Expand Up @@ -208,7 +208,7 @@ pub mod tests {
delimiter: None,
elements: vec![TemplateElement::String {
value: "???".to_string(),
encoded: "???".to_string(),
source: "???".to_string(),
}],
source_info: SourceInfo::new(Pos::new(0, 0), Pos::new(0, 0)),
},
Expand All @@ -224,7 +224,7 @@ pub mod tests {
delimiter: Some('"'),
elements: vec![TemplateElement::String {
value: "//user".to_string(),
encoded: "//user".to_string(),
source: "//user".to_string(),
}],
source_info: SourceInfo::new(Pos::new(1, 7), Pos::new(1, 13)),
},
Expand Down
2 changes: 1 addition & 1 deletion packages/hurl/src/runner/filter/decode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ mod tests {
delimiter: None,
elements: vec![TemplateElement::String {
value: encoding.to_string(),
encoded: encoding.to_string(),
source: encoding.to_string(),
}],
source_info: SourceInfo::new(Pos::new(8, 1), Pos::new(8 + encoding.len(), 1)),
},
Expand Down
2 changes: 1 addition & 1 deletion packages/hurl/src/runner/filter/format.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ mod tests {
delimiter: None,
elements: vec![TemplateElement::String {
value: fmt.to_string(),
encoded: fmt.to_string(),
source: fmt.to_string(),
}],
source_info: SourceInfo::new(Pos::new(8, 1), Pos::new(8 + fmt.len(), 1)),
},
Expand Down
2 changes: 1 addition & 1 deletion packages/hurl/src/runner/filter/jsonpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ mod tests {
delimiter: Some('"'),
elements: vec![TemplateElement::String {
value: "$.message".to_string(),
encoded: "$.message".to_string(),
source: "$.message".to_string(),
}],
source_info: SourceInfo::new(Pos::new(0, 0), Pos::new(0, 0)),
},
Expand Down
4 changes: 2 additions & 2 deletions packages/hurl/src/runner/filter/regex.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ mod tests {
delimiter: None,
elements: vec![TemplateElement::String {
value: "Hello (.*)!".to_string(),
encoded: "Hello (.*)!".to_string(),
source: "Hello (.*)!".to_string(),
}],
source_info: SourceInfo::new(Pos::new(1, 7), Pos::new(1, 20)),
}),
Expand Down Expand Up @@ -117,7 +117,7 @@ mod tests {
delimiter: None,
elements: vec![TemplateElement::String {
value: "???".to_string(),
encoded: "???".to_string(),
source: "???".to_string(),
}],
source_info: SourceInfo::new(Pos::new(1, 7), Pos::new(1, 20)),
}),
Expand Down
4 changes: 2 additions & 2 deletions packages/hurl/src/runner/filter/replace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,15 +64,15 @@ mod tests {
delimiter: None,
elements: vec![TemplateElement::String {
value: "\\s+".to_string(),
encoded: ",".to_string(),
source: ",".to_string(),
}],
source_info: SourceInfo::new(Pos::new(1, 7), Pos::new(1, 20)),
}),
new_value: Template {
delimiter: Some('"'),
elements: vec![TemplateElement::String {
value: ",".to_string(),
encoded: ",".to_string(),
source: ",".to_string(),
}],
source_info: SourceInfo::new(Pos::new(0, 0), Pos::new(0, 0)),
},
Expand Down
2 changes: 1 addition & 1 deletion packages/hurl/src/runner/filter/split.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ mod tests {
delimiter: Some('"'),
elements: vec![TemplateElement::String {
value: ",".to_string(),
encoded: ",".to_string(),
source: ",".to_string(),
}],
source_info: SourceInfo::new(Pos::new(0, 0), Pos::new(0, 0)),
},
Expand Down
4 changes: 2 additions & 2 deletions packages/hurl/src/runner/filter/to_date.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ mod tests {
delimiter: Some('"'),
elements: vec![TemplateElement::String {
value: "%Y %b %d %H:%M:%S%.3f %z".to_string(),
encoded: "%Y %b %d %H:%M:%S%.3f %z".to_string(),
source: "%Y %b %d %H:%M:%S%.3f %z".to_string(),
}],
source_info: SourceInfo::new(Pos::new(0, 0), Pos::new(0, 0)),
},
Expand Down Expand Up @@ -104,7 +104,7 @@ mod tests {
delimiter: Some('"'),
elements: vec![TemplateElement::String {
value: "%a, %d %b %Y %H:%M:%S GMT".to_string(),
encoded: "%a, %d %b %Y %H:%M:%S GMT".to_string(),
source: "%a, %d %b %Y %H:%M:%S GMT".to_string(),
}],
source_info: SourceInfo::new(Pos::new(0, 0), Pos::new(0, 0)),
},
Expand Down
2 changes: 1 addition & 1 deletion packages/hurl/src/runner/filter/xpath.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ mod tests {
delimiter: None,
elements: vec![TemplateElement::String {
value: expr.to_string(),
encoded: expr.to_string(),
source: expr.to_string(),
}],
source_info: SourceInfo::new(Pos::new(7, 1), Pos::new(7 + expr.len(), 1)),
},
Expand Down
18 changes: 9 additions & 9 deletions packages/hurl/src/runner/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ fn eval_json_template_element(
variables: &VariableSet,
) -> Result<String, RunnerError> {
match template_element {
TemplateElement::String { encoded, .. } => Ok(encoded.clone()),
TemplateElement::String { source, .. } => Ok(source.clone()),
TemplateElement::Placeholder(Placeholder { expr, .. }) => {
let s = expr::render(expr, variables)?;
Ok(encode_json_string(&s))
Expand Down Expand Up @@ -193,7 +193,7 @@ mod tests {
elements: vec![
TemplateElement::String {
value: "Hello ".to_string(),
encoded: "Hello\\u0020".to_string(),
source: "Hello\\u0020".to_string(),
},
TemplateElement::Placeholder(Placeholder {
space0: Whitespace {
Expand All @@ -214,7 +214,7 @@ mod tests {
}),
TemplateElement::String {
value: "!".to_string(),
encoded: "!".to_string(),
source: "!".to_string(),
},
],
source_info: SourceInfo::new(Pos::new(1, 2), Pos::new(1, 22)),
Expand All @@ -230,7 +230,7 @@ mod tests {
delimiter: None,
elements: vec![TemplateElement::String {
value: "firstName".to_string(),
encoded: "firstName".to_string(),
source: "firstName".to_string(),
}],
source_info: SourceInfo::new(Pos::new(1, 1), Pos::new(1, 1)),
},
Expand All @@ -240,7 +240,7 @@ mod tests {
delimiter: None,
elements: vec![TemplateElement::String {
value: "John".to_string(),
encoded: "John".to_string(),
source: "John".to_string(),
}],
source_info: SourceInfo::new(Pos::new(1, 1), Pos::new(1, 1)),
}),
Expand Down Expand Up @@ -342,7 +342,7 @@ mod tests {
let template = Template {
delimiter: Some('"'),
elements: vec![TemplateElement::String {
encoded: "Hi".to_string(),
source: "Hi".to_string(),
value: "Hi".to_string(),
}],
source_info: SourceInfo::new(Pos::new(0, 0), Pos::new(0, 0)),
Expand Down Expand Up @@ -405,7 +405,7 @@ mod tests {
delimiter: None,
elements: vec![TemplateElement::String {
value: "\n".to_string(),
encoded: "\\n".to_string(),
source: "\\n".to_string(),
}],
source_info: SourceInfo::new(Pos::new(1, 1), Pos::new(1, 1)),
}),
Expand All @@ -426,7 +426,7 @@ mod tests {
delimiter: None,
elements: vec![TemplateElement::String {
value: "\n".to_string(),
encoded: "\\n".to_string(),
source: "\\n".to_string(),
}],
source_info: SourceInfo::new(Pos::new(1, 1), Pos::new(1, 1)),
},
Expand All @@ -447,7 +447,7 @@ mod tests {
elements: vec![
TemplateElement::String {
value: "Hello ".to_string(),
encoded: "Hello ".to_string(),
source: "Hello ".to_string(),
},
TemplateElement::Placeholder(Placeholder {
space0: whitespace(),
Expand Down
10 changes: 5 additions & 5 deletions packages/hurl/src/runner/multiline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ mod tests {
delimiter: None,
elements: vec![TemplateElement::String {
value: query.to_string(),
encoded: query.to_string(),
source: query.to_string(),
}],
source_info: empty_source_info(),
},
Expand Down Expand Up @@ -143,7 +143,7 @@ mod tests {
delimiter: Some('"'),
elements: vec![TemplateElement::String {
value: "episode".to_string(),
encoded: "episode".to_string(),
source: "episode".to_string(),
}],
source_info: empty_source_info(),
},
Expand All @@ -153,7 +153,7 @@ mod tests {
delimiter: Some('"'),
elements: vec![TemplateElement::String {
value: "JEDI".to_string(),
encoded: "JEDI".to_string(),
source: "JEDI".to_string(),
}],
source_info: empty_source_info(),
}),
Expand All @@ -165,7 +165,7 @@ mod tests {
delimiter: Some('"'),
elements: vec![TemplateElement::String {
value: "withFriends".to_string(),
encoded: "withFriends".to_string(),
source: "withFriends".to_string(),
}],
source_info: empty_source_info(),
},
Expand All @@ -186,7 +186,7 @@ mod tests {
delimiter: None,
elements: vec![TemplateElement::String {
value: query.to_string(),
encoded: query.to_string(),
source: query.to_string(),
}],
source_info: empty_source_info(),
},
Expand Down
12 changes: 6 additions & 6 deletions packages/hurl/src/runner/multipart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ mod tests {
delimiter: None,
elements: vec![TemplateElement::String {
value: "upload1".to_string(),
encoded: "upload1".to_string(),
source: "upload1".to_string(),
}],
source_info: SourceInfo::new(Pos::new(0, 0), Pos::new(0, 0)),
},
Expand All @@ -137,7 +137,7 @@ mod tests {
source_info: SourceInfo::new(Pos::new(0, 0), Pos::new(0, 0)),
elements: vec![TemplateElement::String {
value: "hello.txt".to_string(),
encoded: "hello.txt".to_string(),
source: "hello.txt".to_string(),
}],
},
space1: whitespace(),
Expand Down Expand Up @@ -173,7 +173,7 @@ mod tests {
source_info: SourceInfo::new(Pos::new(0, 0), Pos::new(0, 0)),
elements: vec![TemplateElement::String {
value: "hello.txt".to_string(),
encoded: "hello.txt".to_string()
source: "hello.txt".to_string()
}],
},
space1: whitespace(),
Expand All @@ -195,7 +195,7 @@ mod tests {
source_info: SourceInfo::new(Pos::new(0, 0), Pos::new(0, 0)),
elements: vec![TemplateElement::String {
value: "hello.html".to_string(),
encoded: "hello.html".to_string()
source: "hello.html".to_string()
}],
},
space1: whitespace(),
Expand All @@ -217,7 +217,7 @@ mod tests {
source_info: SourceInfo::new(Pos::new(0, 0), Pos::new(0, 0)),
elements: vec![TemplateElement::String {
value: "hello.txt".to_string(),
encoded: "hello.txt".to_string()
source: "hello.txt".to_string()
}],
},
space1: whitespace(),
Expand All @@ -239,7 +239,7 @@ mod tests {
source_info: SourceInfo::new(Pos::new(0, 0), Pos::new(0, 0)),
elements: vec![TemplateElement::String {
value: "hello".to_string(),
encoded: "hello".to_string()
source: "hello".to_string()
}],
},
space1: whitespace(),
Expand Down
2 changes: 1 addition & 1 deletion packages/hurl/src/runner/predicate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1342,7 +1342,7 @@ mod tests {
delimiter: None,
elements: vec![TemplateElement::String {
value: "toto".to_string(),
encoded: "toto".to_string(),
source: "toto".to_string(),
}],
source_info: SourceInfo::new(Pos::new(0, 0), Pos::new(0, 0)),
}),
Expand Down
Loading

0 comments on commit db9b241

Please sign in to comment.