File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1- // This file is part of the uutils hostname package.
2- //
3- // For the full copyright and license information, please view the LICENSE
4- // file that was distributed with this source code.
51use std:: env;
2+ use std:: sync:: Once ;
63
7- pub const TESTS_BINARY : & str = env ! ( "CARGO_BIN_EXE_hostname" ) ;
4+ static INIT : Once = Once :: new ( ) ;
85
9- // Use the ctor attribute to run this function before any tests
10- #[ ctor:: ctor]
11- fn init ( ) {
12- unsafe {
13- // Necessary for uutests to be able to find the binary
14- std:: env:: set_var ( "UUTESTS_BINARY_PATH" , TESTS_BINARY ) ;
15- }
6+ fn init_binary_path ( ) {
7+ INIT . call_once ( || {
8+ if let Ok ( binary_path) = env:: var ( "CARGO_BIN_EXE_hostname" ) {
9+ unsafe {
10+ env:: set_var ( "UUTESTS_BINARY_PATH" , binary_path) ;
11+ }
12+ }
13+ } ) ;
1614}
1715
16+ // Call init in each test module that needs it
1817#[ cfg( feature = "hostname" ) ]
19- #[ path = "by-util/test_hostname .rs" ]
18+ #[ path = "by_util/hostname .rs" ]
2019mod test_hostname;
20+
21+ #[ cfg( feature = "domainname" ) ]
22+ #[ path = "by_util/domainname.rs" ]
23+ mod test_domainname;
24+
25+ #[ cfg( feature = "dnsdomainname" ) ]
26+ #[ path = "by_util/domainname.rs" ]
27+ mod test_dnsdomainname;
28+
29+ #[ cfg( feature = "nisdomainname" ) ]
30+ #[ path = "by_util/domainname.rs" ]
31+ mod test_nisdomainname;
32+
33+ #[ cfg( feature = "ypdomainname" ) ]
34+ #[ path = "by_util/domainname.rs" ]
35+ mod test_ypdomainname;
You can’t perform that action at this time.
0 commit comments