Compare commits
9 Commits
db43560be5
...
e5e2c98e81
| Author | SHA1 | Date | |
|---|---|---|---|
|
e5e2c98e81
|
|||
|
bcd15ac50e
|
|||
|
c60213ec44
|
|||
|
fa7bc20c8d
|
|||
|
a36d9ed8ee
|
|||
|
6aa84c3bb8
|
|||
|
c4c85adb20
|
|||
|
ce078f294b
|
|||
|
8b700b0404
|
@@ -3,12 +3,12 @@
|
|||||||
(rust-cargo-default-arguments . "-r")
|
(rust-cargo-default-arguments . "-r")
|
||||||
(eglot-workspace-configuration . (:rust-analyzer
|
(eglot-workspace-configuration . (:rust-analyzer
|
||||||
(:check
|
(:check
|
||||||
(:overrideCommand ["ninja" "clippy-json" "-C" "build"]))))
|
(:overrideCommand ["./rust-analyzer.sh"]))))
|
||||||
(eval . (add-to-list 'eglot-server-programs
|
(eval . (add-to-list 'eglot-server-programs
|
||||||
'((rust-ts-mode rust-mode) .
|
'((rust-ts-mode rust-mode) .
|
||||||
("rust-analyzer" :initializationOptions
|
("rust-analyzer" :initializationOptions
|
||||||
(:check
|
(:check
|
||||||
(:overrideCommand ["ninja" "clippy-json" "-C" "build"]))))))
|
(:overrideCommand ["./rust-analyzer.sh"]))))))
|
||||||
(eval . (eglot-ensure))
|
(eval . (eglot-ensure))
|
||||||
(eval . (company-mode 1))
|
(eval . (company-mode 1))
|
||||||
(eval . (add-hook 'before-save-hook 'fmt-current-buffer nil t))
|
(eval . (add-hook 'before-save-hook 'fmt-current-buffer nil t))
|
||||||
|
|||||||
12
rust-analyzer.sh
Executable file
12
rust-analyzer.sh
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# this script is a temporary workaround for not having a proper clippy-json target
|
||||||
|
|
||||||
|
source /etc/profile
|
||||||
|
|
||||||
|
cd build || exit $?
|
||||||
|
|
||||||
|
# compile as far as we can
|
||||||
|
ninja
|
||||||
|
|
||||||
|
ninja clippy-json
|
||||||
@@ -1 +1,7 @@
|
|||||||
tests += {meson.current_source_dir() / 'read_all_profiles.rs': []}
|
tests += {meson.current_source_dir() / 'read_all_profiles.rs': []}
|
||||||
|
tests += {
|
||||||
|
meson.current_source_dir() / 'read_mock_profile.rs': [
|
||||||
|
meson.current_source_dir() / 'mockrepo',
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
|||||||
1
tests/profile/mockrepo/profiles/base/make.defaults
Normal file
1
tests/profile/mockrepo/profiles/base/make.defaults
Normal file
@@ -0,0 +1 @@
|
|||||||
|
USE="base"
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
app-editors/emacs gui
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
..
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
gui
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
USE="emacs"
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
app-editors/emacs default
|
||||||
1
tests/profile/mockrepo/profiles/features/emacs/packages
Normal file
1
tests/profile/mockrepo/profiles/features/emacs/packages
Normal file
@@ -0,0 +1 @@
|
|||||||
|
*app-editors/emacs
|
||||||
1
tests/profile/mockrepo/profiles/features/emacs/parent
Normal file
1
tests/profile/mockrepo/profiles/features/emacs/parent
Normal file
@@ -0,0 +1 @@
|
|||||||
|
../../base
|
||||||
1
tests/profile/mockrepo/profiles/features/emacs/use.force
Normal file
1
tests/profile/mockrepo/profiles/features/emacs/use.force
Normal file
@@ -0,0 +1 @@
|
|||||||
|
default
|
||||||
1
tests/profile/mockrepo/profiles/repo_name
Normal file
1
tests/profile/mockrepo/profiles/repo_name
Normal file
@@ -0,0 +1 @@
|
|||||||
|
mockrepo
|
||||||
58
tests/profile/read_mock_profile.rs
Normal file
58
tests/profile/read_mock_profile.rs
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
use std::env;
|
||||||
|
|
||||||
|
use gentoo_utils::{atom::Atom, repo::Repo, useflag::UseFlag};
|
||||||
|
use itertools::Itertools;
|
||||||
|
|
||||||
|
fn main() {
|
||||||
|
let repo_path = env::args().nth(1).expect("expected path to mock repo");
|
||||||
|
let repo = Repo::new(&repo_path).expect("failed to open repo");
|
||||||
|
let profile = repo
|
||||||
|
.evaluate_profile("features/emacs/gui")
|
||||||
|
.expect("failed to evaluate profile");
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
profile.make_defaults()["USE"]
|
||||||
|
.split_ascii_whitespace()
|
||||||
|
.sorted()
|
||||||
|
.collect::<Vec<_>>(),
|
||||||
|
vec!["base", "emacs"]
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
profile
|
||||||
|
.packages()
|
||||||
|
.iter()
|
||||||
|
.map(Atom::to_string)
|
||||||
|
.collect::<Vec<_>>(),
|
||||||
|
vec!["app-editors/emacs"]
|
||||||
|
);
|
||||||
|
|
||||||
|
let emacs_package_use = profile
|
||||||
|
.package_use()
|
||||||
|
.iter()
|
||||||
|
.find_map(|(atom, flags)| {
|
||||||
|
if atom.clone().into_cp().to_string() == "app-editors/emacs" {
|
||||||
|
Some(flags)
|
||||||
|
} else {
|
||||||
|
None
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.expect("failed to read package.use settings for app-editors/emacs");
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
emacs_package_use
|
||||||
|
.iter()
|
||||||
|
.map(UseFlag::to_string)
|
||||||
|
.collect::<Vec<_>>(),
|
||||||
|
vec!["default", "gui"]
|
||||||
|
);
|
||||||
|
|
||||||
|
assert_eq!(
|
||||||
|
profile
|
||||||
|
.use_force()
|
||||||
|
.iter()
|
||||||
|
.map(UseFlag::to_string)
|
||||||
|
.collect::<Vec<_>>(),
|
||||||
|
vec!["default", "gui"]
|
||||||
|
);
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user