fix autoformatting raw strings
This commit is contained in:
1 parent
563a2b0953
commit
d9e0b9a918
9 files changed
+89
-48
No files matched your search
@@ -4,8 +4,8 @@ macro_rules! twoway {
|
||||
|
||||
// doc attrs
|
||||
$( #[doc = $doc:expr] )*
|
||||
$name:ident
|
||||
),*
|
||||
$name:ident,
|
||||
)*
|
||||
) => {
|
||||
$(
|
||||
$( #[doc = $doc] )*
|
||||
@@ -14,6 +14,9 @@ macro_rules! twoway {
|
||||
let src = include_str!(concat!("./samples/", stringify!($name), ".rsx"));
|
||||
let formatted = dioxus_autofmt::fmt_file(src);
|
||||
let out = dioxus_autofmt::apply_formats(src, formatted);
|
||||
// normalize line endings
|
||||
let out = out.replace("\r", "");
|
||||
let src = src.replace("\r", "");
|
||||
pretty_assertions::assert_eq!(&src, &out);
|
||||
}
|
||||
)*
|
||||
@@ -21,24 +24,25 @@ macro_rules! twoway {
|
||||
}
|
||||
|
||||
twoway![
|
||||
simple,
|
||||
comments,
|
||||
attributes,
|
||||
manual_props,
|
||||
collapse_expr,
|
||||
comments,
|
||||
commentshard,
|
||||
complex,
|
||||
emoji,
|
||||
ifchain_forloop,
|
||||
immediate_expr,
|
||||
key,
|
||||
long_exprs,
|
||||
long,
|
||||
manual_props,
|
||||
messy_indent,
|
||||
multirsx,
|
||||
raw_strings,
|
||||
reallylong,
|
||||
simple,
|
||||
t2,
|
||||
tiny,
|
||||
tinynoopt,
|
||||
long,
|
||||
key,
|
||||
multirsx,
|
||||
commentshard,
|
||||
emoji,
|
||||
messy_indent,
|
||||
long_exprs,
|
||||
ifchain_forloop,
|
||||
t2,
|
||||
reallylong,
|
||||
immediate_expr,
|
||||
collapse_expr,
|
||||
trailing_expr
|
||||
trailing_expr,
|
||||
];
|
||||
@@ -13,7 +13,9 @@ rsx! {
|
||||
|
||||
// Complex nesting with handlers
|
||||
li {
|
||||
Link { class: "flex items-center pl-3 py-3 pr-4 {active_class} rounded", to: "{to}",
|
||||
Link {
|
||||
class: "flex items-center pl-3 py-3 pr-4 {active_class} rounded",
|
||||
to: "{to}",
|
||||
span { class: "inline-block mr-3", icons::icon_0 {} }
|
||||
span { "{name}" }
|
||||
children.is_some().then(|| rsx! {
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
rsx! {
|
||||
// Raw text strings
|
||||
button { r#"Click me"#, r##"Click me"##, r######"Click me"######, r#"dynamic {1}"# }
|
||||
|
||||
// Raw attribute strings
|
||||
div {
|
||||
width: r#"10px"#,
|
||||
height: r##"{10}px"##,
|
||||
"raw-attr": r###"raw-attr"###,
|
||||
"raw-attr2": r###"{100}"###
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,11 @@ macro_rules! twoway {
|
||||
let src_wrong = include_str!(concat!("./wrong/", $val, ".wrong.rsx"));
|
||||
let formatted = dioxus_autofmt::fmt_file(src_wrong);
|
||||
let out = dioxus_autofmt::apply_formats(src_wrong, formatted);
|
||||
|
||||
// normalize line endings
|
||||
let out = out.replace("\r", "");
|
||||
let src_right = src_right.replace("\r", "");
|
||||
|
||||
pretty_assertions::assert_eq!(&src_right, &out);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user