summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCyril Plisko <cyril.plisko@replixio.com>2017-09-02 15:07:59 +0300
committerCyril Plisko <cyril.plisko@replixio.com>2017-09-02 15:07:59 +0300
commita61abc00f71ef1803516d8de413564f3093b0e67 (patch)
tree86f7b98b3f8618df40d01f1c0c341acb347e1c85
parent00a89f6e0c04674cb13db1a0ab79f1decfdf0a69 (diff)
Add nopager test
-rw-r--r--src/utils.rs10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/utils.rs b/src/utils.rs
index 78c4d8a..084b48b 100644
--- a/src/utils.rs
+++ b/src/utils.rs
@@ -70,8 +70,7 @@ pub fn find_pager(env: &str) -> Option<OsString> {
#[cfg(test)]
mod tests {
- use super::{find_pager, which};
- use std::ffi::OsString;
+ use super::*;
#[cfg(target_os = "linux")]
const MORE: &'static str = "/bin/more";
@@ -98,4 +97,11 @@ mod tests {
fn usr_bin_more_default_pager() {
assert_eq!(find_pager("__RANDOM_NAME"), Some(OsString::from(MORE)));
}
+
+ #[test]
+ fn nopager() {
+ env::set_var("NOPAGER", "");
+ assert!(find_pager("more").is_none());
+ env::remove_var("NOPAGER");
+ }
}