1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
//! This module mocks `std::env` in order to test the `Updater` struct.
//!
//! The `Updater` struct is responsible for moving the application's executable
//! file and then restarting the application. In order to do that, it queries
//! its environment for information. This module mocks the critical parts of
//! `std::env` using `mockall`, in order to test the `Updater` struct by
//! controlling the environmental information that gets returned. This is
//! important because unit tests run via the Cargo test runner, and so the
//! information that would be obtained is about the test runner, which should
//! not be moved or restarted.
//!
//! The approach taken is that the "real" code imports functionality from
//! `std::env` when running in non-test mode, but imports the mocked functions
//! when running in test mode. This is achieved by using conditional
//! compilation. The test code then configures the mocks to expect certain
//! requests and to return certain responses, and then runs the tests.
//!
// Packages
use RefCell;
use ReentrantMutex;
use ;
// Statics
pub static MOCK_EXE: = new;
// Functions
// mock_current_exe