whitequark / rust-xdg

A library that makes it easy to follow the X Desktop Group specifications
https://wiki.freedesktop.org/www/Specifications/
Apache License 2.0
154 stars 30 forks source link

Added option to override home #69

Closed Swivelgames closed 6 months ago

Swivelgames commented 6 months ago

Fixes #68

[!WARNING] Does this PR include changes that break backwards compatibility? No

Introduced new methods:

Tests Coverage:


Coverage Summary

- 59.14% coverage, 178/301 lines covered
+ 63.87% coverage, 198/310 lines covered, +4.73% change in coverage

Notable New Coverage

+ 228-229    pub fn new() -> BaseDirectories {
+ 236-237    pub fn with_prefix<P: AsRef<Path>>(prefix: P) -> BaseDirectories {
+ 258-263    pub fn with_profile<P1, P2>(prefix: P1, profile: P2) -> BaseDirectories
+ 554-562    pub fn find_state_file<P: AsRef<Path>>(&self, path: P) -> Option<PathBuf> {

Existing Tests: Fixes and Coverage Improvements


Abbreviated Coverage Reports

main Branch Test Coverage Report ``` $ cargo tarpaulin --out Html 2024-03-12T21:32:47.174649Z INFO cargo_tarpaulin::config: Creating config 2024-03-12T21:32:47.313183Z INFO cargo_tarpaulin: Running Tarpaulin 2024-03-12T21:32:47.313257Z INFO cargo_tarpaulin: Building project 2024-03-12T21:32:47.313278Z INFO cargo_tarpaulin::cargo: Cleaning project Compiling xdg v2.5.2 (/home/jdalrymple/src/third-party/rust-xdg) Finished test [unoptimized + debuginfo] target(s) in 1.96s 2024-03-12T21:33:00.019806Z INFO cargo_tarpaulin::process_handling::linux: Launching test 2024-03-12T21:33:00.019921Z INFO cargo_tarpaulin::process_handling: running /home/jdalrymple/.cache/cargo/target/debug/deps/xdg-130be4bb313f686f running 10 tests test base_directories::test::test_files_exists ... ok test base_directories::test::test_profile ... ok test base_directories::test::test_runtime_bad ... ok test base_directories::test::test_symlinks ... ok test base_directories::test::test_prefix ... ok test base_directories::test::test_get_file ... ok test base_directories::test::test_bad_environment ... ok test base_directories::test::test_runtime_good ... ok test base_directories::test::test_lists ... ok test base_directories::test::test_good_environment ... ok test result: ok. 10 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.05s 2024-03-12T21:33:01.369951Z INFO cargo_tarpaulin::report: Coverage Results: || Tested/Total Lines: || src/base_directories.rs: 178/301 || 59.14% coverage, 178/301 lines covered ```
home-dir Branch Test Coverage Report ``` $ cargo tarpaulin --out Html 2024-03-12T21:33:23.391096Z INFO cargo_tarpaulin::config: Creating config 2024-03-12T21:33:23.442409Z INFO cargo_tarpaulin: Running Tarpaulin 2024-03-12T21:33:23.442433Z INFO cargo_tarpaulin: Building project 2024-03-12T21:33:23.442443Z INFO cargo_tarpaulin::cargo: Cleaning project Compiling xdg v2.5.2 (/home/jdalrymple/src/third-party/rust-xdg) Finished test [unoptimized + debuginfo] target(s) in 2.15s 2024-03-12T21:33:25.773135Z INFO cargo_tarpaulin::process_handling::linux: Launching test 2024-03-12T21:33:25.773265Z INFO cargo_tarpaulin::process_handling: running /home/jdalrymple/.cache/cargo/target/debug/deps/xdg-130be4bb313f686f running 18 tests test base_directories::test::test_files_exists ... ok test base_directories::test::test_profile ... ok test base_directories::test::test_bad_environment ... ok test base_directories::test::test_prefix ... ok test base_directories::test::test_no_environment ... ok test base_directories::test::test_home_environment ... ok test base_directories::test::test_get_file ... ok test base_directories::test::test_lists ... ok test base_directories::test::test_good_environment ... ok test base_directories::test::test_runtime_bad ... ok test base_directories::test::test_symlinks ... ok test base_directories::test::test_public_new ... ok test base_directories::test::test_public_with_home ... ok test base_directories::test::test_public_with_home_prefix ... ok test base_directories::test::test_public_with_home_profile ... ok test base_directories::test::test_public_with_prefix ... ok test base_directories::test::test_runtime_good ... ok test base_directories::test::test_public_with_profile ... ok test result: ok. 18 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.06s 2024-03-12T21:33:27.056177Z INFO cargo_tarpaulin::report: Coverage Results: || Tested/Total Lines: || src/base_directories.rs: 198/310 +4.73% || 63.87% coverage, 198/310 lines covered, +4.73% change in coverage ```
Swivelgames commented 6 months ago

Cancelled.