fix: tests

This commit is contained in:
Jonathan Kelley committed 2022-01-05 17:30:12 -05:00
1 parent e2a6454527
commit bd341f5571
17 files changed
+305 -300

No files matched your search

+22 -2
View File
@@ -187,8 +187,12 @@ impl Parse for ComponentField {
}
if input.peek(LitStr) && input.peek2(Token![,]) {
let content = ContentField::Formatted(input.parse()?);
return Ok(Self { name, content });
let t: LitStr = input.fork().parse()?;
if is_literal_foramtted(&t) {
let content = ContentField::Formatted(input.parse()?);
return Ok(Self { name, content });
}
}
if input.peek(LitStr) && input.peek2(LitStr) {
@@ -209,3 +213,19 @@ impl ToTokens for ComponentField {
})
}
}
fn is_literal_foramtted(lit: &LitStr) -> bool {
let s = lit.value();
let mut chars = s.chars();
while let Some(next) = chars.next() {
if next == '{' {
let nen = chars.next();
if nen == Some('{') {
return true;
}
}
}
false
}