Skip to content

Commit

Permalink
fix CI
Browse files Browse the repository at this point in the history
  • Loading branch information
hamza1311 committed Aug 14, 2022
1 parent b8cf9b8 commit ec4f599
Show file tree
Hide file tree
Showing 4 changed files with 269 additions and 25 deletions.
2 changes: 1 addition & 1 deletion packages/yew-macro/src/props/prop.rs
Expand Up @@ -28,7 +28,7 @@ impl Parse for Prop {
fn parse(input: ParseStream) -> syn::Result<Self> {
let directive = input
.parse::<Token![~]>()
.map(|parsed| PropDirective::ApplyAsProperty(parsed))
.map(PropDirective::ApplyAsProperty)
.ok();
if input.peek(Brace) {
Self::parse_shorthand_prop_assignment(input, directive)
Expand Down
27 changes: 25 additions & 2 deletions packages/yew-macro/tests/html_macro/component-fail.stderr
Expand Up @@ -249,7 +249,13 @@ help: escape `type` to use it as an identifier
85 | html! { <Child r#type=0 /> };
| ++

error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.
error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.: Tuple(
ExprTuple {
attrs: [],
paren_token: Paren,
elems: [],
},
)
--> tests/html_macro/component-fail.rs:86:24
|
86 | html! { <Child ref=() /> };
Expand Down Expand Up @@ -309,7 +315,24 @@ error: only one root html element is allowed (hint: you can wrap multiple html e
102 | html! { <Child></Child><Child></Child> };
| ^^^^^^^^^^^^^^^

error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.
error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.: Path(
ExprPath {
attrs: [],
qself: None,
path: Path {
leading_colon: None,
segments: [
PathSegment {
ident: Ident {
ident: "num",
span: #0 bytes(3894..3897),
},
arguments: None,
},
],
},
},
)
--> tests/html_macro/component-fail.rs:106:24
|
106 | html! { <Child int=num ..props /> };
Expand Down
219 changes: 209 additions & 10 deletions packages/yew-macro/tests/html_macro/element-fail.stderr
Expand Up @@ -142,61 +142,260 @@ error: dynamic closing tags must not have a body (hint: replace it with just `</
75 | html! { <@{"test"}></@{"test"}> };
| ^^^^^^^^

error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.
error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.: Tuple(
ExprTuple {
attrs: [],
paren_token: Paren,
elems: [
Lit(
ExprLit {
attrs: [],
lit: Str(
LitStr {
token: "deprecated",
},
),
},
),
Comma,
Lit(
ExprLit {
attrs: [],
lit: Str(
LitStr {
token: "warning",
},
),
},
),
],
},
)
--> tests/html_macro/element-fail.rs:83:24
|
83 | html! { <div class=("deprecated", "warning") /> };
| ^^^^^^^^^^^^^^^^^^^^^^^^^

error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.
error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.: Tuple(
ExprTuple {
attrs: [],
paren_token: Paren,
elems: [],
},
)
--> tests/html_macro/element-fail.rs:84:24
|
84 | html! { <input ref=() /> };
| ^^

error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.
error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.: Tuple(
ExprTuple {
attrs: [],
paren_token: Paren,
elems: [],
},
)
--> tests/html_macro/element-fail.rs:85:24
|
85 | html! { <input ref=() ref=() /> };
| ^^

error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.
error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.: Call(
ExprCall {
attrs: [],
func: Path(
ExprPath {
attrs: [],
qself: None,
path: Path {
leading_colon: None,
segments: [
PathSegment {
ident: Ident {
ident: "Some",
span: #0 bytes(2632..2636),
},
arguments: None,
},
],
},
},
),
paren_token: Paren,
args: [
Lit(
ExprLit {
attrs: [],
lit: Int(
LitInt {
token: 5,
},
),
},
),
],
},
)
--> tests/html_macro/element-fail.rs:86:28
|
86 | html! { <input onfocus=Some(5) /> };
| ^^^^^^^

error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.
error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.: Path(
ExprPath {
attrs: [],
qself: None,
path: Path {
leading_colon: None,
segments: [
PathSegment {
ident: Ident {
ident: "NotToString",
span: #0 bytes(2672..2683),
},
arguments: None,
},
],
},
},
)
--> tests/html_macro/element-fail.rs:87:27
|
87 | html! { <input string=NotToString /> };
| ^^^^^^^^^^^

error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.
error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.: Call(
ExprCall {
attrs: [],
func: Path(
ExprPath {
attrs: [],
qself: None,
path: Path {
leading_colon: None,
segments: [
PathSegment {
ident: Ident {
ident: "Some",
span: #0 bytes(2711..2715),
},
arguments: None,
},
],
},
},
),
paren_token: Paren,
args: [
Path(
ExprPath {
attrs: [],
qself: None,
path: Path {
leading_colon: None,
segments: [
PathSegment {
ident: Ident {
ident: "NotToString",
span: #0 bytes(2716..2727),
},
arguments: None,
},
],
},
},
),
],
},
)
--> tests/html_macro/element-fail.rs:88:22
|
88 | html! { <a media=Some(NotToString) /> };
| ^^^^^^^^^^^^^^^^^

error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.
error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.: Call(
ExprCall {
attrs: [],
func: Path(
ExprPath {
attrs: [],
qself: None,
path: Path {
leading_colon: None,
segments: [
PathSegment {
ident: Ident {
ident: "Some",
span: #0 bytes(2755..2759),
},
arguments: None,
},
],
},
},
),
paren_token: Paren,
args: [
Lit(
ExprLit {
attrs: [],
lit: Int(
LitInt {
token: 5,
},
),
},
),
],
},
)
--> tests/html_macro/element-fail.rs:89:21
|
89 | html! { <a href=Some(5) /> };
| ^^^^^^^

error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.
error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.: Tuple(
ExprTuple {
attrs: [],
paren_token: Paren,
elems: [],
},
)
--> tests/html_macro/element-fail.rs:90:25
|
90 | html! { <input type=() /> };
| ^^

error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.
error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.: Tuple(
ExprTuple {
attrs: [],
paren_token: Paren,
elems: [],
},
)
--> tests/html_macro/element-fail.rs:91:26
|
91 | html! { <input value=() /> };
| ^^

error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.
error: the property value must be either a literal or enclosed in braces. Consider adding braces around your expression.: Path(
ExprPath {
attrs: [],
qself: None,
path: Path {
leading_colon: None,
segments: [
PathSegment {
ident: Ident {
ident: "NotToString",
span: #0 bytes(2862..2873),
},
arguments: None,
},
],
},
},
)
--> tests/html_macro/element-fail.rs:92:27
|
92 | html! { <input string=NotToString /> };
Expand Down

0 comments on commit ec4f599

Please sign in to comment.