From 0c1734a19d1deb7f6b47da3b3b09ee7688534788 Mon Sep 17 00:00:00 2001 From: Martin von Zweigbergk Date: Sat, 5 Mar 2022 20:06:12 -0800 Subject: [PATCH] editorconfig: disable trim_trailing_whitespace due to multi-line bugs The `trim_trailing_whitespace` config is not working well with multi-line string literals. I've tried to work around intellij-rust/intellij-rust#5368 twice and now I want to use the `insta` crate so I'd need to find another workaround. Let's just disable the config instead. I wouldn't be surprised if other editors have similar bugs as IntelliJ. --- .editorconfig | 4 +++- tests/smoke_test.rs | 17 +++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.editorconfig b/.editorconfig index bf1ef9cc2..b0a2889a1 100644 --- a/.editorconfig +++ b/.editorconfig @@ -2,7 +2,9 @@ root = true [*] end_of_line = lf -trim_trailing_whitespace = true +# Turned off because some editors otherwise remove trailing spaces within +# multi-line string literals (intellij-rust/intellij-rust#5368). +trim_trailing_whitespace = false [*.rs] indent_style = space diff --git a/tests/smoke_test.rs b/tests/smoke_test.rs index 62133db03..190efb0fa 100644 --- a/tests/smoke_test.rs +++ b/tests/smoke_test.rs @@ -24,8 +24,10 @@ fn smoke_test() { let repo_path = test_env.env_root().join("repo"); // Check the output of `jj status` right after initializing repo - let expected_output = - "Parent commit: 000000000000 \nWorking copy : 1d1984a23811 \nThe working copy is clean\n"; + let expected_output = "Parent commit: 000000000000 +Working copy : 1d1984a23811 +The working copy is clean +"; test_env .jj_cmd(&repo_path, &["status"]) .assert() @@ -38,8 +40,9 @@ fn smoke_test() { std::fs::write(repo_path.join("file3"), "file3").unwrap(); // The working copy's ID should have changed - let expected_output = "Parent commit: 000000000000 \nWorking copy : 5e60c5091e43 \nWorking \ - copy changes: + let expected_output = "Parent commit: 000000000000 +Working copy : 5e60c5091e43 +Working copy changes: A file1 A file2 A file3 @@ -58,7 +61,8 @@ A file3 .stdout(expected_output); // Add a commit description - let expected_output = "Working copy now at: 6f13b3e41065 add some files\n"; + let expected_output = "Working copy now at: 6f13b3e41065 add some files +"; test_env .jj_cmd(&repo_path, &["describe", "-m", "add some files"]) .assert() @@ -66,7 +70,8 @@ A file3 .stdout(expected_output); // Close the commit - let expected_output = "Working copy now at: 6ff8a22d8ce1 \n"; + let expected_output = "Working copy now at: 6ff8a22d8ce1 +"; test_env .jj_cmd(&repo_path, &["close"]) .assert()