From 7d732a051e695353db5a3ddbb26ab766ff736043 Mon Sep 17 00:00:00 2001 From: Akshay Date: Fri, 14 Jan 2022 18:09:42 +0530 Subject: refactor parsing code, simplify tests --- bin/src/utils.rs | 4 +++- bin/tests/main.rs | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'bin') diff --git a/bin/src/utils.rs b/bin/src/utils.rs index d374b4b..a3d51b4 100644 --- a/bin/src/utils.rs +++ b/bin/src/utils.rs @@ -30,6 +30,8 @@ pub fn get_version_info() -> Option { .output() .expect("failed to execute"); std::str::from_utf8(&program.stdout) - .ok() + .ok()? + .split(' ') + .nth(2) .map(ToOwned::to_owned) } diff --git a/bin/tests/main.rs b/bin/tests/main.rs index 991c876..89d58e7 100644 --- a/bin/tests/main.rs +++ b/bin/tests/main.rs @@ -19,7 +19,7 @@ mod util { test_lint!($($tail)*); }; ($tname:ident) => { - test_lint!($tname => session_info!("nix (Nix) 2.5")); + test_lint!($tname => session_info!("2.5")); }; ($tname:ident => $sess:expr) => { #[test] @@ -61,5 +61,5 @@ test_lint! { unquoted_uri, deprecated_is_null, empty_inherit, - faster_groupby => session_info!("nix (Nix) 2.5") + faster_groupby => session_info!("2.5") } -- cgit v1.2.3