From 2242c8ba0dc7ff8d05085fecf3d2f50b3251d664 Mon Sep 17 00:00:00 2001 From: jcamiel Date: Thu, 24 Nov 2022 15:10:13 +0100 Subject: [PATCH] Rename TextOneLine to OneLineText. --- packages/hurl/src/runner/multiline.rs | 2 +- packages/hurl_core/src/ast/core.rs | 4 ++-- packages/hurl_core/src/format/html.rs | 6 +++--- packages/hurl_core/src/parser/multiline.rs | 8 ++++---- packages/hurlfmt/src/format/json.rs | 2 +- packages/hurlfmt/src/format/token.rs | 2 +- packages/hurlfmt/src/linter/rules.rs | 2 +- 7 files changed, 13 insertions(+), 13 deletions(-) diff --git a/packages/hurl/src/runner/multiline.rs b/packages/hurl/src/runner/multiline.rs index 9611e3d70..243bb62e6 100644 --- a/packages/hurl/src/runner/multiline.rs +++ b/packages/hurl/src/runner/multiline.rs @@ -26,7 +26,7 @@ pub fn eval_multiline( variables: &HashMap, ) -> Result { match multiline { - MultilineString::TextOneline(value) => { + MultilineString::OneLineText(value) => { let s = eval_template(value, variables)?; Ok(s) } diff --git a/packages/hurl_core/src/ast/core.rs b/packages/hurl_core/src/ast/core.rs index 64df217f9..519c11933 100644 --- a/packages/hurl_core/src/ast/core.rs +++ b/packages/hurl_core/src/ast/core.rs @@ -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(), diff --git a/packages/hurl_core/src/format/html.rs b/packages/hurl_core/src/format/html.rs index b4ccfcc2f..cf0d906a4 100644 --- a/packages/hurl_core/src/format/html.rs +++ b/packages/hurl_core/src/format/html.rs @@ -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!("{}", 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(), diff --git a/packages/hurl_core/src/parser/multiline.rs b/packages/hurl_core/src/parser/multiline.rs index ccccb2cc3..80ab09205 100644 --- a/packages/hurl_core/src/parser/multiline.rs +++ b/packages/hurl_core/src/parser/multiline.rs @@ -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(), diff --git a/packages/hurlfmt/src/format/json.rs b/packages/hurlfmt/src/format/json.rs index 987eeb598..94d340e29 100644 --- a/packages/hurlfmt/src/format/json.rs +++ b/packages/hurlfmt/src/format/json.rs @@ -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", diff --git a/packages/hurlfmt/src/format/token.rs b/packages/hurlfmt/src/format/token.rs index b96eaf43e..5f8792726 100644 --- a/packages/hurlfmt/src/format/token.rs +++ b/packages/hurlfmt/src/format/token.rs @@ -606,7 +606,7 @@ impl Tokenizable for PredicateValue { impl Tokenizable for MultilineString { fn tokenize(&self) -> Vec { let lang = match self { - MultilineString::TextOneline(_) => None, + MultilineString::OneLineText(_) => None, MultilineString::Text(_) => None, MultilineString::Json(_) => Some("json"), MultilineString::Xml(_) => Some("xml"), diff --git a/packages/hurlfmt/src/linter/rules.rs b/packages/hurlfmt/src/linter/rules.rs index 4d4b3bb27..d8c37cc4e 100644 --- a/packages/hurlfmt/src/linter/rules.rs +++ b/packages/hurlfmt/src/linter/rules.rs @@ -520,7 +520,7 @@ impl Lintable 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()),