crates/cli/git-ents/tests/toolchain.rs
toolchain.rshistorycomment on this file
| 1 | //! Integration coverage for `git ents toolchain` against a real local |
| 2 | //! composition root (`roots.local`) — importing a toolchain, then listing |
| 3 | //! it back. |
| 4 | |
| 5 | #![allow(clippy::expect_used, reason = "integration test")] |
| 6 | |
| 7 | mod common; |
| 8 | |
| 9 | use git_ents::commands::toolchain; |
| 10 | use git_ents::root::LocalRoot; |
| 11 | |
| 12 | /// `git ents toolchain list` names every imported toolchain — the only way |
| 13 | /// to discover a toolchain's name before `view`/`log` can be run against it |
| 14 | /// (`model.toolchain`). |
| 15 | // @relation(roots.local, model.toolchain, scope=function, role=Verifies) |
| 16 | #[test] |
| 17 | fn list_names_every_imported_toolchain() { |
| 18 | let fixture = common::Fixture::new(1); |
| 19 | let root = LocalRoot::open(fixture.path()).expect("opens"); |
| 20 | |
| 21 | let bin = fixture.path().join("bin"); |
| 22 | std::fs::create_dir(&bin).expect("mkdir"); |
| 23 | std::fs::write(bin.join("tool"), b"#!/bin/sh\necho hi\n").expect("write"); |
| 24 | |
| 25 | toolchain::import(&root, "rust-stable", &bin, Some(fixture.key_path.clone())).expect("imports"); |
| 26 | |
| 27 | let listed = toolchain::list(&root).expect("lists"); |
| 28 | assert_eq!(listed, vec!["rust-stable".to_owned()]); |
| 29 | } |