Skip to content

Commit 8417684

Browse files
committed
Check all IDE config hashes in ./x test bootstrap, update Helix hash
1 parent d9f125d commit 8417684

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

src/bootstrap/src/core/build_steps/setup.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -531,6 +531,16 @@ enum EditorKind {
531531
}
532532

533533
impl EditorKind {
534+
// Used in `./tests.rs`.
535+
#[allow(dead_code)]
536+
pub const ALL: &[EditorKind] = &[
537+
EditorKind::Emacs,
538+
EditorKind::Helix,
539+
EditorKind::Vim,
540+
EditorKind::VsCode,
541+
EditorKind::Zed,
542+
];
543+
534544
fn prompt_user() -> io::Result<Option<EditorKind>> {
535545
let prompt_str = "Available editors:
536546
1. Emacs
@@ -575,9 +585,10 @@ Select which editor you would like to set up [default: None]: ";
575585
"51068d4747a13732440d1a8b8f432603badb1864fa431d83d0fd4f8fa57039e0",
576586
"d29af4d949bbe2371eac928a3c31cf9496b1701aa1c45f11cd6c759865ad5c45",
577587
],
578-
EditorKind::Helix => {
579-
&["2d3069b8cf1b977e5d4023965eb6199597755e6c96c185ed5f2854f98b83d233"]
580-
}
588+
EditorKind::Helix => &[
589+
"2d3069b8cf1b977e5d4023965eb6199597755e6c96c185ed5f2854f98b83d233",
590+
"6736d61409fbebba0933afd2e4c44ff2f97c1cb36cf0299a7f4a7819b8775040",
591+
],
581592
EditorKind::Vim | EditorKind::VsCode => &[
582593
"ea67e259dedf60d4429b6c349a564ffcd1563cf41c920a856d1f5b16b4701ac8",
583594
"56e7bf011c71c5d81e0bf42e84938111847a810eee69d906bba494ea90b51922",

src/bootstrap/src/core/build_steps/setup/tests.rs

+12-9
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,16 @@ use crate::utils::helpers::hex_encode;
55

66
#[test]
77
fn check_matching_settings_hash() {
8-
let editor = EditorKind::Vscode;
9-
let mut hasher = sha2::Sha256::new();
10-
hasher.update(&editor.settings_template());
11-
let hash = hex_encode(hasher.finalize().as_slice());
12-
assert_eq!(
13-
&hash,
14-
editor.hashes().last().unwrap(),
15-
"Update `EditorKind::hashes()` with the new hash of `src/etc/rust_analyzer_settings.json`"
16-
);
8+
for editor in EditorKind::ALL {
9+
let mut hasher = sha2::Sha256::new();
10+
hasher.update(&editor.settings_template());
11+
let hash = hex_encode(hasher.finalize().as_slice());
12+
assert_eq!(
13+
&hash,
14+
editor.hashes().last().unwrap(),
15+
"Update `EditorKind::hashes()` with the new hash of `{}` for `EditorKind::{:?}`",
16+
editor.settings_template(),
17+
editor,
18+
);
19+
}
1720
}

0 commit comments

Comments
 (0)