Skip to content

Commit 5cd22c4

Browse files
committed
move files from src/bin -> src/uu
t# This is a combination of 3 commits. move files from src/bin -> src/uu/<sub directory>
1 parent 60da916 commit 5cd22c4

File tree

13 files changed

+115
-202
lines changed

13 files changed

+115
-202
lines changed

.github/workflows/ci.yml

Lines changed: 1 addition & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -124,18 +124,4 @@ jobs:
124124
## flags: IntegrationTests, UnitTests, ${{ steps.vars.outputs.CODECOV_FLAGS }}
125125
flags: ${{ steps.vars.outputs.CODECOV_FLAGS }}
126126
name: codecov-umbrella
127-
fail_ci_if_error: false
128-
129-
wrapper-tests:
130-
name: wrapper binaries integration tests
131-
runs-on: ${{ matrix.os }}
132-
strategy:
133-
matrix:
134-
os: [ubuntu-latest, macOS-latest, windows-latest]
135-
steps:
136-
- uses: actions/checkout@v6
137-
- uses: dtolnay/rust-toolchain@stable
138-
- name: Run wrapper binary tests
139-
run: |
140-
# Run only the wrapper integration tests to validate wrapper behavior
141-
cargo test --test test_wrapper_binaries -- --nocapture
127+
fail_ci_if_error: false

Cargo.lock

Lines changed: 0 additions & 64 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ rand = { workspace = true }
7575
uutests = { workspace = true }
7676
ctor = { workspace = true }
7777
uucore = { workspace = true, features = ["entries", "process", "signals"] }
78-
assert_cmd = "2.0"
7978

8079
[target.'cfg(unix)'.dev-dependencies]
8180
xattr = { workspace = true }

tests/by-util/test_hostname.rs

Lines changed: 0 additions & 11 deletions
This file was deleted.

tests/by_util/domainname.rs

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
use assert_cmd::Command;
2+
use predicates::prelude::*;
3+
4+
/// Assert that `--help` succeeds and prints either the binary name or Usage text
5+
fn assert_help(bin: &str) {
6+
Command::cargo_bin(bin)
7+
.unwrap()
8+
.arg("--help")
9+
.assert()
10+
.success()
11+
.stdout(
12+
predicate::str::contains(bin)
13+
.or(predicate::str::contains("Usage")),
14+
);
15+
}
16+
17+
/// Assert that `--version` succeeds and prints the binary name
18+
fn assert_version(bin: &str) {
19+
Command::cargo_bin(bin)
20+
.unwrap()
21+
.arg("--version")
22+
.assert()
23+
.success()
24+
.stdout(predicate::str::contains(bin));
25+
}
26+
27+
#[test]
28+
fn dnsdomainname_help() {
29+
assert_help("dnsdomainname");
30+
}
31+
32+
#[test]
33+
fn domainname_help() {
34+
assert_help("domainname");
35+
}
36+
37+
#[test]
38+
fn nisdomainname_help() {
39+
assert_help("nisdomainname");
40+
}
41+
42+
#[test]
43+
fn ypdomainname_help() {
44+
assert_help("ypdomainname");
45+
}
46+
47+
#[test]
48+
fn dnsdomainname_version() {
49+
assert_version("dnsdomainname");
50+
}
51+
52+
#[test]
53+
fn domainname_version() {
54+
assert_version("domainname");
55+
}
56+
57+
#[test]
58+
fn nisdomainname_version() {
59+
assert_version("nisdomainname");
60+
}
61+
62+
#[test]
63+
fn ypdomainname_version() {
64+
assert_version("ypdomainname");
65+
}

tests/by_util/hostname.rs

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
use uutests::new_ucmd;
2+
3+
pub const TESTS_BINARY: &str = env!("CARGO_BIN_EXE_hostname");
4+
5+
// Use the ctor attribute to run this function before any tests
6+
#[ctor::ctor]
7+
fn init() {
8+
unsafe {
9+
// Necessary for uutests to be able to find the binary
10+
std::env::set_var("UUTESTS_BINARY_PATH", TESTS_BINARY);
11+
}
12+
}
13+
14+
15+
#[test]
16+
fn test_invalid_arg() {
17+
init();
18+
new_ucmd!().arg("--definitely-invalid").fails().code_is(1);
19+
}
20+
21+
#[test]
22+
fn test_help_flag() {
23+
init();
24+
new_ucmd!().arg("--help").succeeds();
25+
}
26+
27+
#[test]
28+
fn test_version_flag() {
29+
init();
30+
new_ucmd!().arg("--version").succeeds();
31+
}

0 commit comments

Comments
 (0)