1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

od: fix failing test unable to find temp dir on linux

This commit is contained in:
modelorganism 2016-04-29 20:17:51 -05:00
parent 3f356a4190
commit caebd834c6

View file

@ -20,7 +20,8 @@ static ALPHA_OUT: &'static str = "0000000 061141 062143 063145 064147 065
#[test] #[test]
fn test_file() { fn test_file() {
let (_, mut ucmd) = testing(UTIL_NAME); let (_, mut ucmd) = testing(UTIL_NAME);
let temp = env::var("TMPDIR").unwrap_or_else(|_| env::var("TEMP").unwrap()); use std::env;
let temp = env::temp_dir();
let tmpdir = Path::new(&temp); let tmpdir = Path::new(&temp);
let file = tmpdir.join("test"); let file = tmpdir.join("test");
@ -45,7 +46,7 @@ fn test_file() {
#[test] #[test]
fn test_2files() { fn test_2files() {
let (_, mut ucmd) = testing(UTIL_NAME); let (_, mut ucmd) = testing(UTIL_NAME);
let temp = env::var("TMPDIR").unwrap_or_else(|_| env::var("TEMP").unwrap()); let temp = env::temp_dir();
let tmpdir = Path::new(&temp); let tmpdir = Path::new(&temp);
let file1 = tmpdir.join("test1"); let file1 = tmpdir.join("test1");
let file2 = tmpdir.join("test2"); let file2 = tmpdir.join("test2");
@ -76,7 +77,7 @@ fn test_2files() {
#[test] #[test]
fn test_no_file() { fn test_no_file() {
let (_, mut ucmd) = testing(UTIL_NAME); let (_, mut ucmd) = testing(UTIL_NAME);
let temp = env::var("TMPDIR").unwrap_or_else(|_| env::var("TEMP").unwrap()); let temp = env::temp_dir();
let tmpdir = Path::new(&temp); let tmpdir = Path::new(&temp);
let file = tmpdir.join("}surely'none'would'thus'a'file'name"); let file = tmpdir.join("}surely'none'would'thus'a'file'name");
@ -104,7 +105,7 @@ fn test_from_stdin() {
fn test_from_mixed() { fn test_from_mixed() {
let (_, mut ucmd) = testing(UTIL_NAME); let (_, mut ucmd) = testing(UTIL_NAME);
let temp = env::var("TMPDIR").unwrap_or_else(|_| env::var("TEMP").unwrap()); let temp = env::temp_dir();
let tmpdir = Path::new(&temp); let tmpdir = Path::new(&temp);
let file1 = tmpdir.join("test-1"); let file1 = tmpdir.join("test-1");
let file3 = tmpdir.join("test-3"); let file3 = tmpdir.join("test-3");