Skip to content

Commit 9a91371

Browse files
unhappychoiceclaude
andcommitted
test(install/rc): verify Nushell inline-snippet embedding
Nushell is the only shell whose rc block contains the full snippet rather than a single eval/source line, so cover it explicitly: the appended block contains the hook setup, the marker is written exactly once, and re-running wire_shell_rc returns UpToDate. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 3ebf18c commit 9a91371

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

‎src/install/rc.rs‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,27 @@ trailing\n"
248248
assert!(rc.exists());
249249
}
250250

251+
/// Nushell can't use the eval-on-startup indirection the POSIX shells use, so the
252+
/// marker block embeds the full snippet inline. Re-running install must still
253+
/// replace the block in place rather than appending a second copy.
254+
#[test]
255+
fn wire_shell_rc_embeds_nushell_snippet_inline_and_is_idempotent() {
256+
let dir = tempdir().unwrap();
257+
let rc = dir.path().join("config.nu");
258+
std::fs::write(&rc, "# user config\n").unwrap();
259+
260+
let appended = wire_shell_rc(Shell::Nushell, Some(rc.clone())).unwrap();
261+
assert_eq!(appended.action, RcAction::Appended);
262+
let contents = std::fs::read_to_string(&rc).unwrap();
263+
assert!(contents.starts_with("# user config\n"));
264+
assert!(contents.contains("env_change.PWD"));
265+
assert!(contents.contains("^splashboard"));
266+
assert_eq!(contents.matches(MARKER_OPEN).count(), 1);
267+
268+
let up_to_date = wire_shell_rc(Shell::Nushell, Some(rc.clone())).unwrap();
269+
assert_eq!(up_to_date.action, RcAction::UpToDate);
270+
}
271+
251272
#[test]
252273
fn wire_shell_rc_appends_replaces_and_skips_when_current() {
253274
let dir = tempdir().unwrap();

0 commit comments

Comments
 (0)