-
-
Notifications
You must be signed in to change notification settings - Fork 107
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
Configure for the inline snapshot indentation #605
Comments
Thanks for the issue! It should give reasonable indentation already. Could you post a reproducible example? The source can just be a literal string. |
Starting from this test: #[test]
fn test_foo() {
assert_snapshot!(
"aaa\nbbb\nccc\nddd",
@""
);
} After review: #[test]
fn test_foo() {
assert_snapshot!(
"aaa\nbbb\nccc\nddd",
@r###"
aaa
bbb
ccc
ddd
"###
);
} If starting from oneline: #[test]
fn test_foo() {
assert_snapshot!("aaa\nbbb\nccc\nddd", @"");
} After review: #[test]
fn test_foo() {
assert_snapshot!("aaa\nbbb\nccc\nddd", @r###"
aaa
bbb
ccc
ddd
"###);
} I've a tool using ast-grep to replace #[test]
fn test_foo() {
assert_snapshot!("aaa\nbbb\nccc\nddd", -r###"
aaa
bbb
ccc
ddd
"###);
}
#[test]
fn test_foo() {
assert_snapshot!(
"aaa\nbbb\nccc\nddd",
-r###"
aaa
bbb
ccc
ddd
"###
);
} replace #[test]
fn test_foo() {
assert_snapshot!(
"aaa\nbbb\nccc\nddd",
@r###"
aaa
bbb
ccc
ddd
"###
);
} |
Sorry for being slow — am I understanding correctly that the current output and the desired output have the same indentation? And the difference is the opening delimiter? (Am on phone so possibly I'm missing something...) |
Thank you for quick reply! #[test]
fn test_foo() {
assert_snapshot!(
"aaa\nbbb\nccc\nddd",
@r###"
aaa
bbb
ccc
ddd
"###
);
} while I get #[test]
fn test_foo() {
assert_snapshot!(
"aaa\nbbb\nccc\nddd",
@r###"
aaa
bbb
ccc
ddd
"###
);
} |
I think a couple of things here:
|
Indeed. These maybe project-specific preference. The better way could be keeping the default behavior and format using ast-grep in project desiring different style. Thank you very much! |
Maybe further, in |
(great, will reply in #499) |
To reply to:
I would vote to stay away from any ambiguities like this; confusion there would be very expensive... |
Hi , thank you for the awesome tool!
Currently,
cargo insta review
generates inline snapshots in the form like:I wonder if it's possbile to make the following output with project-level configuration:
Maybe related to #457
The text was updated successfully, but these errors were encountered: