-
Notifications
You must be signed in to change notification settings - Fork 5.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed SwayFmt removing comments in configurable blocks #5297
Changes from 8 commits
6636598
8fb5a12
a3fd251
0519bc4
ed998df
c94d396
f02b929
67ea4c1
b8a37db
6b2acff
d45ff0b
3e1562d
9a2fa74
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1608,6 +1608,40 @@ impl MyContract for Contract { | |
); | ||
} | ||
|
||
#[test] | ||
fn configurable_comments() { | ||
check( | ||
r#" | ||
script; | ||
|
||
use std::{constants::ZERO_B256, vm::evm::evm_address::EvmAddress}; | ||
|
||
configurable { | ||
// config test | ||
/// config test triple | ||
SIGNER: EvmAddress = EvmAddress { | ||
value: ZERO_B256, | ||
}, | ||
} | ||
|
||
fn main() {}"#, | ||
r#"script; | ||
|
||
use std::{constants::ZERO_B256, vm::evm::evm_address::EvmAddress}; | ||
|
||
configurable { | ||
// config test | ||
/// config test triple | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for adding tests! It would be good to test inline comments as well, e.g. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, good catch! That style of comment is coming out a little strange after testing it just now. Weird behaviors with whitespace. Gonna dig into this a little more 👍 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After digging into the behaviors a little more, I discovered that this strange whitespace formatting behavior exists across other various items. I have put detailed it in this issue: #5298. Seems like what I found may be outside of the scope of this issue. I added the Let me know what you think! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for opening the issue. I agree that it's out of scope for this issue, but it would be great to have that test case added as part of #5298 |
||
SIGNER: EvmAddress = EvmAddress { | ||
value: ZERO_B256, | ||
}, | ||
} | ||
|
||
fn main() {} | ||
"#, | ||
); | ||
} | ||
|
||
#[test] | ||
fn empty_fn() { | ||
check( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it would be also useful to test adding comments inside of structs and enums in configurable blocks, and at the end of the line.