Skip to content

Commit 5dc7b3d

Browse files
committed
pinky: move unit test away from integration tests
1 parent 68a0369 commit 5dc7b3d

File tree

2 files changed

+15
-9
lines changed

2 files changed

+15
-9
lines changed

src/uu/pinky/src/pinky.rs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,3 +135,16 @@ impl Capitalize for str {
135135
})
136136
}
137137
}
138+
139+
#[cfg(test)]
140+
mod test {
141+
use super::*;
142+
143+
#[test]
144+
fn test_capitalize() {
145+
assert_eq!("Zbnmasd", "zbnmasd".capitalize()); // spell-checker:disable-line
146+
assert_eq!("Abnmasd", "Abnmasd".capitalize()); // spell-checker:disable-line
147+
assert_eq!("1masd", "1masd".capitalize()); // spell-checker:disable-line
148+
assert_eq!("", "".capitalize());
149+
}
150+
}

tests/by-util/test_pinky.rs

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// For the full copyright and license information, please view the LICENSE
44
// file that was distributed with this source code.
55

6-
use pinky::Capitalize;
76
#[cfg(not(target_os = "openbsd"))]
87
use uucore::entries::{Locate, Passwd};
98
use uutests::new_ucmd;
@@ -19,17 +18,11 @@ fn test_invalid_arg() {
1918
new_ucmd!().arg("--definitely-invalid").fails_with_code(1);
2019
}
2120

22-
#[test]
23-
fn test_capitalize() {
24-
assert_eq!("Zbnmasd", "zbnmasd".capitalize()); // spell-checker:disable-line
25-
assert_eq!("Abnmasd", "Abnmasd".capitalize()); // spell-checker:disable-line
26-
assert_eq!("1masd", "1masd".capitalize()); // spell-checker:disable-line
27-
assert_eq!("", "".capitalize());
28-
}
29-
3021
#[test]
3122
#[cfg(not(target_os = "openbsd"))]
3223
fn test_long_format() {
24+
use pinky::Capitalize;
25+
3326
let login = "root";
3427
let pw: Passwd = Passwd::locate(login).unwrap();
3528
let user_info = pw.user_info.unwrap_or_default();

0 commit comments

Comments
 (0)