Preserve bytearray format choice from input.
This commit is contained in:
@@ -311,22 +311,6 @@ fn test_block_logical_expr() {
|
||||
assert_fmt(src, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_format_bytearray_literals() {
|
||||
let src = indoc! {r#"
|
||||
const foo = #"ff00"
|
||||
const bar = #[0, 255]
|
||||
"#};
|
||||
|
||||
let expected = indoc! { r#"
|
||||
const foo = #"ff00"
|
||||
|
||||
const bar = #"00ff"
|
||||
"#};
|
||||
|
||||
assert_fmt(src, expected);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_nested_function_calls() {
|
||||
let src = indoc! {r#"
|
||||
@@ -503,3 +487,20 @@ fn test_newline_module_comments() {
|
||||
|
||||
assert_fmt(src, out);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_bytearray_literals() {
|
||||
let src = indoc! {r#"
|
||||
const foo_const_array = #[102, 111, 111]
|
||||
|
||||
const foo_const_hex = #"666f6f"
|
||||
|
||||
fn foo() {
|
||||
let foo_const_array = #[102, 111, 111]
|
||||
|
||||
let foo_const_hex = #"666f6f"
|
||||
}
|
||||
"#};
|
||||
|
||||
assert_fmt(src, src);
|
||||
}
|
||||
|
||||
@@ -1785,6 +1785,7 @@ fn plain_bytearray_literals() {
|
||||
value: Box::new(Constant::ByteArray {
|
||||
location: Span::new((), 25..39),
|
||||
bytes: vec![0, 170, 255],
|
||||
preferred_format: ast::ByteArrayFormatPreference::ArrayOfBytes,
|
||||
}),
|
||||
tipo: (),
|
||||
})],
|
||||
@@ -1813,6 +1814,7 @@ fn base16_bytearray_literals() {
|
||||
value: Box::new(Constant::ByteArray {
|
||||
location: Span::new((), 25..34),
|
||||
bytes: vec![0, 170, 255],
|
||||
preferred_format: ast::ByteArrayFormatPreference::HexadecimalString,
|
||||
}),
|
||||
tipo: (),
|
||||
}),
|
||||
@@ -1828,6 +1830,7 @@ fn base16_bytearray_literals() {
|
||||
right: Box::new(expr::UntypedExpr::ByteArray {
|
||||
location: Span::new((), 71..80),
|
||||
bytes: vec![0, 170, 255],
|
||||
preferred_format: ast::ByteArrayFormatPreference::HexadecimalString,
|
||||
}),
|
||||
},
|
||||
doc: None,
|
||||
|
||||
Reference in New Issue
Block a user