mirror of
https://github.com/Orange-OpenSource/hurl.git
synced 2024-11-26 00:22:10 +03:00
Rename TextOneLine to OneLineText.
This commit is contained in:
parent
a0f7d3e278
commit
2242c8ba0d
@ -26,7 +26,7 @@ pub fn eval_multiline(
|
||||
variables: &HashMap<String, Value>,
|
||||
) -> Result<String, Error> {
|
||||
match multiline {
|
||||
MultilineString::TextOneline(value) => {
|
||||
MultilineString::OneLineText(value) => {
|
||||
let s = eval_template(value, variables)?;
|
||||
Ok(s)
|
||||
}
|
||||
|
@ -483,7 +483,7 @@ pub enum PredicateFuncValue {
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum MultilineString {
|
||||
// FIXME: temporary type until we implement oneline as `foo` instead of ```foo```
|
||||
TextOneline(Template),
|
||||
OneLineText(Template),
|
||||
Text(Text),
|
||||
Json(Text),
|
||||
Xml(Text),
|
||||
@ -493,7 +493,7 @@ pub enum MultilineString {
|
||||
impl MultilineString {
|
||||
pub fn value(&self) -> Template {
|
||||
match self {
|
||||
MultilineString::TextOneline(template) => template.clone(),
|
||||
MultilineString::OneLineText(template) => template.clone(),
|
||||
MultilineString::Text(text)
|
||||
| MultilineString::Json(text)
|
||||
| MultilineString::Xml(text) => text.value.clone(),
|
||||
|
@ -863,7 +863,7 @@ impl Htmlable for PredicateValue {
|
||||
impl Htmlable for MultilineString {
|
||||
fn to_html(&self) -> String {
|
||||
let lang = match self {
|
||||
MultilineString::TextOneline(_) => {
|
||||
MultilineString::OneLineText(_) => {
|
||||
let s = format!("```{value}```", value = self.value());
|
||||
let buffer = multilines(&s);
|
||||
return format!("<span class=\"multiline\">{}</span>", buffer);
|
||||
@ -1085,7 +1085,7 @@ mod tests {
|
||||
#[test]
|
||||
fn test_multiline_string() {
|
||||
// ``````
|
||||
let multiline_string = MultilineString::TextOneline(Template {
|
||||
let multiline_string = MultilineString::OneLineText(Template {
|
||||
quotes: false,
|
||||
elements: vec![TemplateElement::String {
|
||||
value: "".to_string(),
|
||||
@ -1099,7 +1099,7 @@ mod tests {
|
||||
);
|
||||
|
||||
// ```hello```
|
||||
let multiline_string = MultilineString::TextOneline(Template {
|
||||
let multiline_string = MultilineString::OneLineText(Template {
|
||||
quotes: false,
|
||||
elements: vec![TemplateElement::String {
|
||||
value: "hello".to_string(),
|
||||
|
@ -31,7 +31,7 @@ pub fn multiline_string(reader: &mut Reader) -> ParseResult<'static, MultilineSt
|
||||
Err(_) => {
|
||||
reader.state = save;
|
||||
let value = oneline_string_value(reader)?;
|
||||
Ok(MultilineString::TextOneline(value))
|
||||
Ok(MultilineString::OneLineText(value))
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -295,7 +295,7 @@ mod tests {
|
||||
let mut reader = Reader::init("``````");
|
||||
assert_eq!(
|
||||
multiline_string(&mut reader).unwrap(),
|
||||
MultilineString::TextOneline(Template {
|
||||
MultilineString::OneLineText(Template {
|
||||
quotes: false,
|
||||
elements: vec![],
|
||||
source_info: SourceInfo::new(1, 4, 1, 4),
|
||||
@ -347,7 +347,7 @@ mod tests {
|
||||
let mut reader = Reader::init("```Hello World!```");
|
||||
assert_eq!(
|
||||
multiline_string(&mut reader).unwrap(),
|
||||
MultilineString::TextOneline(Template {
|
||||
MultilineString::OneLineText(Template {
|
||||
quotes: false,
|
||||
elements: vec![TemplateElement::String {
|
||||
value: "Hello World!".to_string(),
|
||||
@ -363,7 +363,7 @@ mod tests {
|
||||
let mut reader = Reader::init("```base64_inline```");
|
||||
assert_eq!(
|
||||
multiline_string(&mut reader).unwrap(),
|
||||
MultilineString::TextOneline(Template {
|
||||
MultilineString::OneLineText(Template {
|
||||
quotes: false,
|
||||
elements: vec![TemplateElement::String {
|
||||
value: "base64_inline".to_string(),
|
||||
|
@ -158,7 +158,7 @@ impl ToJson for Bytes {
|
||||
// base64,SGVsbG8gd29ybGQ=;
|
||||
// ~~~
|
||||
let lang = match multi {
|
||||
MultilineString::TextOneline(_) | MultilineString::Text(_) => {
|
||||
MultilineString::OneLineText(_) | MultilineString::Text(_) => {
|
||||
"multiline-string"
|
||||
}
|
||||
MultilineString::Json(_) => "json",
|
||||
|
@ -606,7 +606,7 @@ impl Tokenizable for PredicateValue {
|
||||
impl Tokenizable for MultilineString {
|
||||
fn tokenize(&self) -> Vec<Token> {
|
||||
let lang = match self {
|
||||
MultilineString::TextOneline(_) => None,
|
||||
MultilineString::OneLineText(_) => None,
|
||||
MultilineString::Text(_) => None,
|
||||
MultilineString::Json(_) => Some("json"),
|
||||
MultilineString::Xml(_) => Some("xml"),
|
||||
|
@ -520,7 +520,7 @@ impl Lintable<MultilineString> for MultilineString {
|
||||
|
||||
fn lint(&self) -> MultilineString {
|
||||
match self {
|
||||
MultilineString::TextOneline(value) => MultilineString::TextOneline(value.lint()),
|
||||
MultilineString::OneLineText(value) => MultilineString::OneLineText(value.lint()),
|
||||
MultilineString::Text(value) => MultilineString::Text(value.lint()),
|
||||
MultilineString::Json(value) => MultilineString::Json(value.lint()),
|
||||
MultilineString::Xml(value) => MultilineString::Xml(value.lint()),
|
||||
|
Loading…
Reference in New Issue
Block a user